Logo ROOT  
Reference Guide
TObject.cxx
Go to the documentation of this file.
1// @(#)root/base:$Id$
2// Author: Rene Brun 26/12/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/** \class TObject
13\ingroup Base
14
15Mother of all ROOT objects.
16
17The TObject class provides default behaviour and protocol for all
18objects in the ROOT system. It provides protocol for object I/O,
19error handling, sorting, inspection, printing, drawing, etc.
20Every object which inherits from TObject can be stored in the
21ROOT collection classes.
22
23TObject's bits can be used as flags, bits 0 - 13 and 24-31 are
24reserved as global bits while bits 14 - 23 can be used in different
25class hierarchies (watch out for overlaps).
26*/
27
28#include <cstring>
29#if !defined(WIN32) && !defined(__MWERKS__) && !defined(R__SOLARIS)
30#include <strings.h>
31#endif
32#include <cstdlib>
33#include <cstdio>
34#include <sstream>
35#include <fstream>
36#include <iostream>
37
38#include "Varargs.h"
39#include "snprintf.h"
40#include "TObject.h"
41#include "TBuffer.h"
42#include "TClass.h"
43#include "TGuiFactory.h"
44#include "TMethod.h"
45#include "TROOT.h"
46#include "TError.h"
47#include "TObjectTable.h"
48#include "TVirtualPad.h"
49#include "TInterpreter.h"
50#include "TMemberInspector.h"
51#include "TRefTable.h"
52#include "TProcessID.h"
53
56
58
59#if defined(__clang__) || defined (__GNUC__)
60# define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
61#else
62# define ATTRIBUTE_NO_SANITIZE_ADDRESS
63#endif
64
65namespace ROOT {
66namespace Internal {
67
68// Return true if delete changes/poisons/taints the memory.
69//
70// Detect whether operator delete taints the memory. If it does, we can not rely
71// on TestBit(kNotDeleted) to check if the memory has been deleted (but in case,
72// like TClonesArray, where we know the destructor will be called but not operator
73// delete, we can still use it to detect the cases where the destructor was called.
74
77{
78 static constexpr UInt_t kGoldenUUID = 0x00000021;
79 static constexpr UInt_t kGoldenbits = 0x03000000;
80
81 TObject *o = new TObject;
82 o->SetUniqueID(kGoldenUUID);
83 UInt_t *o_fuid = &(o->fUniqueID);
84 UInt_t *o_fbits = &(o->fBits);
85
86 if (*o_fuid != kGoldenUUID) {
87 Error("CheckingDeleteSideEffects",
88 "fUniqueID is not as expected, we got 0x%.8x instead of 0x%.8x",
89 *o_fuid, kGoldenUUID);
90 }
91 if (*o_fbits != kGoldenbits) {
92 Error("CheckingDeleteSideEffects",
93 "fBits is not as expected, we got 0x%.8x instead of 0x%.8x",
94 *o_fbits, kGoldenbits);
95 }
96 if (gDebug >= 9) {
97 unsigned char *oc = reinterpret_cast<unsigned char *>(o); // for address calculations
98 unsigned char references[sizeof(TObject)];
99 memcpy(references, oc, sizeof(TObject));
100
101 // The effective part of this code (the else statement is just that without
102 // any of the debug statement)
103 delete o;
104
105 // Not using the error logger, as there routine is meant to be called
106 // during library initialization/loading.
107 fprintf(stderr,
108 "DEBUG: Checking before and after delete the content of a TObject with uniqueID 0x21\n");
109 for(size_t i = 0; i < sizeof(TObject); i += 4) {
110 fprintf(stderr, "DEBUG: 0x%.8x vs 0x%.8x\n", *(int*)(references +i), *(int*)(oc + i));
111 }
112 } else
113 delete o; // the 'if' part is that surrounded by the debug code.
114
115 // Intentionally accessing the deleted memory to check whether it has been changed as
116 // a consequence (side effect) of executing operator delete. If there no change, we
117 // can guess this is always the case and we can rely on the changes to fBits made
118 // by ~TObject to detect use-after-delete error (and print a message rather than
119 // stop the program with a segmentation fault)
120 if ( *o_fbits != 0x01000000 ) {
121 // operator delete tainted the memory, we can not rely on TestBit(kNotDeleted)
122 return true;
123 }
124 return false;
125}
126
128{
129 static const bool value = DeleteChangesMemoryImpl();
130 if (gDebug >= 9)
131 DeleteChangesMemoryImpl(); // To allow for printing the debug info
132 return value;
133}
134
135}} // ROOT::Detail
136
137////////////////////////////////////////////////////////////////////////////////
138/// Copy this to obj.
139
140void TObject::Copy(TObject &obj) const
141{
142 obj.fUniqueID = fUniqueID; // when really unique don't copy
143 if (obj.IsOnHeap()) { // test uses fBits so don't move next line
144 obj.fBits = fBits;
145 obj.fBits |= kIsOnHeap;
146 } else {
147 obj.fBits = fBits;
148 obj.fBits &= ~kIsOnHeap;
149 }
150 obj.fBits &= ~kIsReferenced;
151 obj.fBits &= ~kCanDelete;
152}
153
154////////////////////////////////////////////////////////////////////////////////
155/// TObject destructor. Removes object from all canvases and object browsers
156/// if observer bit is on and remove from the global object table.
157
160 // if (!TestBit(kNotDeleted))
161 // Fatal("~TObject", "object deleted twice");
162
164
165 fBits &= ~kNotDeleted;
166
168}
169
170////////////////////////////////////////////////////////////////////////////////
171/// Private helper function which will dispatch to
172/// TObjectTable::AddObj.
173/// Included here to avoid circular dependency between header files.
174
176{
178}
179
180////////////////////////////////////////////////////////////////////////////////
181/// Append graphics object to current pad. In case no current pad is set
182/// yet, create a default canvas with the name "c1".
183
185{
186 if (!gPad) {
187 gROOT->MakeDefCanvas();
188 }
189 if (!gPad->IsEditable()) return;
191 gPad->GetListOfPrimitives()->Add(this,option);
192 gPad->Modified(kTRUE);
193}
194
195////////////////////////////////////////////////////////////////////////////////
196/// Browse object. May be overridden for another default action
197
199{
200 //Inspect();
201 TClass::AutoBrowse(this,b);
202}
203
204////////////////////////////////////////////////////////////////////////////////
205/// Returns name of class to which the object belongs.
206
207const char *TObject::ClassName() const
208{
209 return IsA()->GetName();
210}
211
212////////////////////////////////////////////////////////////////////////////////
213/// Make a clone of an object using the Streamer facility.
214/// If the object derives from TNamed, this function is called
215/// by TNamed::Clone. TNamed::Clone uses the optional argument to set
216/// a new name to the newly created object.
217///
218/// If the object class has a DirectoryAutoAdd function, it will be
219/// called at the end of the function with the parameter gDirectory.
220/// This usually means that the object will be appended to the current
221/// ROOT directory.
222
223TObject *TObject::Clone(const char *) const
224{
225 if (gDirectory) {
226 return gDirectory->CloneObject(this);
227 } else {
228 // Some of the streamer (eg. roofit's) expect(ed?) a valid gDirectory during streaming.
229 return gROOT->CloneObject(this);
230 }
231}
232
233////////////////////////////////////////////////////////////////////////////////
234/// Compare abstract method. Must be overridden if a class wants to be able
235/// to compare itself with other objects. Must return -1 if this is smaller
236/// than obj, 0 if objects are equal and 1 if this is larger than obj.
237
239{
240 AbstractMethod("Compare");
241 return 0;
242}
243
244////////////////////////////////////////////////////////////////////////////////
245/// Delete this object. Typically called as a command via the interpreter.
246/// Normally use "delete" operator when object has been allocated on the heap.
247
249{
250 if (IsOnHeap()) {
251 // Delete object from CINT symbol table so it can not be used anymore.
252 // CINT object are always on the heap.
253 gInterpreter->DeleteGlobal(this);
254
255 delete this;
256 }
257}
258
259
260////////////////////////////////////////////////////////////////////////////////
261/// Computes distance from point (px,py) to the object.
262/// This member function must be implemented for each graphics primitive.
263/// This default function returns a big number (999999).
264
266{
267 // AbstractMethod("DistancetoPrimitive");
268 return 999999;
269}
270
271////////////////////////////////////////////////////////////////////////////////
272/// Default Draw method for all objects
273
275{
277}
278
279////////////////////////////////////////////////////////////////////////////////
280/// Draw class inheritance tree of the class to which this object belongs.
281/// If a class B inherits from a class A, description of B is drawn
282/// on the right side of description of A.
283/// Member functions overridden by B are shown in class A with a blue line
284/// crossing-out the corresponding member function.
285/// The following picture is the class inheritance tree of class TPaveLabel:
286///
287/// \image html base_object.png
288
290{
291 IsA()->Draw();
292}
293
294////////////////////////////////////////////////////////////////////////////////
295/// Draw a clone of this object in the current selected pad with:
296/// `gROOT->SetSelectedPad(c1)`.
297/// If pad was not selected - `gPad` will be used.
298
300{
301 TVirtualPad::TContext ctxt(true);
302 auto pad = gROOT->GetSelectedPad();
303 if (pad)
304 pad->cd();
305
306 TObject *newobj = Clone();
307 if (!newobj)
308 return nullptr;
309
310 if (!option || !*option)
312
313 if (pad) {
314 pad->GetListOfPrimitives()->Add(newobj, option);
315 pad->Modified(kTRUE);
316 pad->Update();
317 } else {
318 newobj->Draw(option);
319 }
320
321 return newobj;
322}
323
324////////////////////////////////////////////////////////////////////////////////
325/// Dump contents of object on stdout.
326/// Using the information in the object dictionary (class TClass)
327/// each data member is interpreted.
328/// If a data member is a pointer, the pointer value is printed
329///
330/// The following output is the Dump of a TArrow object:
331/// ~~~ {.cpp}
332/// fAngle 0 Arrow opening angle (degrees)
333/// fArrowSize 0.2 Arrow Size
334/// fOption.*fData
335/// fX1 0.1 X of 1st point
336/// fY1 0.15 Y of 1st point
337/// fX2 0.67 X of 2nd point
338/// fY2 0.83 Y of 2nd point
339/// fUniqueID 0 object unique identifier
340/// fBits 50331648 bit field status word
341/// fLineColor 1 line color
342/// fLineStyle 1 line style
343/// fLineWidth 1 line width
344/// fFillColor 19 fill area color
345/// fFillStyle 1001 fill area style
346/// ~~~
347
348void TObject::Dump() const
349{
350 // Get the actual address of the object.
351 const void *actual = IsA()->DynamicCast(TObject::Class(),this,kFALSE);
352 IsA()->Dump(actual);
353}
354
355////////////////////////////////////////////////////////////////////////////////
356/// Execute method on this object with the given parameter string, e.g.
357/// "3.14,1,\"text\"".
358
359void TObject::Execute(const char *method, const char *params, Int_t *error)
360{
361 if (!IsA()) return;
362
363 Bool_t must_cleanup = TestBit(kMustCleanup);
364
365 gInterpreter->Execute(this, IsA(), method, params, error);
366
367 if (gPad && must_cleanup) gPad->Modified();
368}
369
370////////////////////////////////////////////////////////////////////////////////
371/// Execute method on this object with parameters stored in the TObjArray.
372/// The TObjArray should contain an argv vector like:
373/// ~~~ {.cpp}
374/// argv[0] ... argv[n] = the list of TObjString parameters
375/// ~~~
376
377void TObject::Execute(TMethod *method, TObjArray *params, Int_t *error)
378{
379 if (!IsA()) return;
380
381 Bool_t must_cleanup = TestBit(kMustCleanup);
382
383 gInterpreter->Execute(this, IsA(), method, params, error);
384
385 if (gPad && must_cleanup) gPad->Modified();
386}
387
388
389////////////////////////////////////////////////////////////////////////////////
390/// Execute action corresponding to an event at (px,py). This method
391/// must be overridden if an object can react to graphics events.
392
394{
395 // AbstractMethod("ExecuteEvent");
396}
397
398////////////////////////////////////////////////////////////////////////////////
399/// Must be redefined in derived classes.
400/// This function is typically used with TCollections, but can also be used
401/// to find an object by name inside this object.
402
403TObject *TObject::FindObject(const char *) const
404{
405 return nullptr;
406}
407
408////////////////////////////////////////////////////////////////////////////////
409/// Must be redefined in derived classes.
410/// This function is typically used with TCollections, but can also be used
411/// to find an object inside this object.
412
414{
415 return nullptr;
416}
417
418////////////////////////////////////////////////////////////////////////////////
419/// Get option used by the graphics system to draw this object.
420/// Note that before calling object.GetDrawOption(), you must
421/// have called object.Draw(..) before in the current pad.
422
424{
425 if (!gPad) return "";
426
427 TListIter next(gPad->GetListOfPrimitives());
428 while (auto obj = next()) {
429 if (obj == this)
430 return next.GetOption();
431 }
432 return "";
433}
434
435////////////////////////////////////////////////////////////////////////////////
436/// Returns name of object. This default method returns the class name.
437/// Classes that give objects a name should override this method.
438
439const char *TObject::GetName() const
440{
441 return IsA()->GetName();
442}
443
444////////////////////////////////////////////////////////////////////////////////
445/// Returns mime type name of object. Used by the TBrowser (via TGMimeTypes
446/// class). Override for class of which you would like to have different
447/// icons for objects of the same class.
448
449const char *TObject::GetIconName() const
450{
451 return nullptr;
452}
453
454////////////////////////////////////////////////////////////////////////////////
455/// Return the unique object id.
456
458{
459 return fUniqueID;
460}
461
462////////////////////////////////////////////////////////////////////////////////
463/// Returns string containing info about the object at position (px,py).
464/// This method is typically overridden by classes of which the objects
465/// can report peculiarities for different positions.
466/// Returned string will be re-used (lock in MT environment).
467
469{
470 if (!gPad) return (char*)"";
471 static char info[64];
472 Float_t x = gPad->AbsPixeltoX(px);
473 Float_t y = gPad->AbsPixeltoY(py);
474 snprintf(info,64,"x=%g, y=%g",gPad->PadtoX(x),gPad->PadtoY(y));
475 return info;
476}
477
478////////////////////////////////////////////////////////////////////////////////
479/// Returns title of object. This default method returns the class title
480/// (i.e. description). Classes that give objects a title should override
481/// this method.
482
483const char *TObject::GetTitle() const
484{
485 return IsA()->GetTitle();
486}
487
488
489////////////////////////////////////////////////////////////////////////////////
490/// Execute action in response of a timer timing out. This method
491/// must be overridden if an object has to react to timers.
492
494{
495 return kFALSE;
496}
497
498////////////////////////////////////////////////////////////////////////////////
499/// Return hash value for this object.
500///
501/// Note: If this routine is overloaded in a derived class, this derived class
502/// should also add
503/// ~~~ {.cpp}
504/// ROOT::CallRecursiveRemoveIfNeeded(*this)
505/// ~~~
506/// Otherwise, when RecursiveRemove is called (by ~TObject or example) for this
507/// type of object, the transversal of THashList and THashTable containers will
508/// will have to be done without call Hash (and hence be linear rather than
509/// logarithmic complexity). You will also see warnings like
510/// ~~~
511/// Error in <ROOT::Internal::TCheckHashRecursiveRemoveConsistency::CheckRecursiveRemove>: The class SomeName overrides TObject::Hash but does not call TROOT::RecursiveRemove in its destructor.
512/// ~~~
513///
514
516{
517 //return (ULong_t) this >> 2;
518 const void *ptr = this;
519 return TString::Hash(&ptr, sizeof(void*));
520}
521
522////////////////////////////////////////////////////////////////////////////////
523/// Returns kTRUE if object inherits from class "classname".
524
525Bool_t TObject::InheritsFrom(const char *classname) const
526{
527 return IsA()->InheritsFrom(classname);
528}
529
530////////////////////////////////////////////////////////////////////////////////
531/// Returns kTRUE if object inherits from TClass cl.
532
534{
535 return IsA()->InheritsFrom(cl);
536}
537
538////////////////////////////////////////////////////////////////////////////////
539/// Dump contents of this object in a graphics canvas.
540/// Same action as Dump but in a graphical form.
541/// In addition pointers to other objects can be followed.
542///
543/// The following picture is the Inspect of a histogram object:
544/// \image html base_inspect.png
545
547{
548 gGuiFactory->CreateInspectorImp(this, 400, 200);
549}
550
551////////////////////////////////////////////////////////////////////////////////
552/// Returns kTRUE in case object contains browsable objects (like containers
553/// or lists of other objects).
554
556{
557 return kFALSE;
558}
559
560////////////////////////////////////////////////////////////////////////////////
561/// Default equal comparison (objects are equal if they have the same
562/// address in memory). More complicated classes might want to override
563/// this function.
564
566{
567 return obj == this;
568}
569
570////////////////////////////////////////////////////////////////////////////////
571/// The ls function lists the contents of a class on stdout. Ls output
572/// is typically much less verbose then Dump().
573
575{
577 std::cout <<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << " : ";
578 std::cout << Int_t(TestBit(kCanDelete));
579 if (option && strstr(option,"noaddr")==nullptr) {
580 std::cout <<" at: "<< this ;
581 }
582 std::cout << std::endl;
583}
584
585////////////////////////////////////////////////////////////////////////////////
586/// This method must be overridden to handle object notification.
587
589{
590 return kFALSE;
591}
592
593////////////////////////////////////////////////////////////////////////////////
594/// This method must be overridden if a class wants to paint itself.
595/// The difference between Paint() and Draw() is that when a object
596/// draws itself it is added to the display list of the pad in
597/// which it is drawn (and automatically redrawn whenever the pad is
598/// redrawn). While paint just draws the object without adding it to
599/// the pad display list.
600
602{
603 // AbstractMethod("Paint");
604}
605
606////////////////////////////////////////////////////////////////////////////////
607/// Pop on object drawn in a pad to the top of the display list. I.e. it
608/// will be drawn last and on top of all other primitives.
609
611{
612 if (!gPad) return;
613
614 if (this == gPad->GetListOfPrimitives()->Last()) return;
615
616 TListIter next(gPad->GetListOfPrimitives());
617 while (auto obj = next())
618 if (obj == this) {
619 TString opt = next.GetOption();
620 gPad->GetListOfPrimitives()->Remove((TObject*)this);
621 gPad->GetListOfPrimitives()->AddLast(this, opt.Data());
622 gPad->Modified();
623 return;
624 }
625}
626
627////////////////////////////////////////////////////////////////////////////////
628/// This method must be overridden when a class wants to print itself.
629
631{
632 std::cout <<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << std::endl;
633}
634
635////////////////////////////////////////////////////////////////////////////////
636/// Read contents of object with specified name from the current directory.
637/// First the key with the given name is searched in the current directory,
638/// next the key buffer is deserialized into the object.
639/// The object must have been created before via the default constructor.
640/// See TObject::Write().
641
643{
644 if (gDirectory)
645 return gDirectory->ReadTObject(this,name);
646 return 0;
647}
648
649////////////////////////////////////////////////////////////////////////////////
650/// Recursively remove this object from a list. Typically implemented
651/// by classes that can contain multiple references to a same object.
652
654{
655}
656
657
658////////////////////////////////////////////////////////////////////////////////
659/// Save this object in the file specified by filename.
660///
661/// - if "filename" contains ".root" the object is saved in filename as root
662/// binary file.
663///
664/// - if "filename" contains ".xml" the object is saved in filename as a xml
665/// ascii file.
666///
667/// - if "filename" contains ".cc" the object is saved in filename as C code
668/// independant from ROOT. The code is generated via SavePrimitive().
669/// Specific code should be implemented in each object to handle this
670/// option. Like in TF1::SavePrimitive().
671///
672/// - otherwise the object is written to filename as a CINT/C++ script. The
673/// C++ code to rebuild this object is generated via SavePrimitive(). The
674/// "option" parameter is passed to SavePrimitive. By default it is an empty
675/// string. It can be used to specify the Draw option in the code generated
676/// by SavePrimitive.
677///
678/// The function is available via the object context menu.
679
680void TObject::SaveAs(const char *filename, Option_t *option) const
681{
682 //==============Save object as a root file===================================
683 if (filename && strstr(filename,".root")) {
684 if (gDirectory) gDirectory->SaveObjectAs(this,filename,"");
685 return;
686 }
687
688 //==============Save object as a XML file====================================
689 if (filename && strstr(filename,".xml")) {
690 if (gDirectory) gDirectory->SaveObjectAs(this,filename,"");
691 return;
692 }
693
694 //==============Save object as a JSON file================================
695 if (filename && strstr(filename,".json")) {
696 if (gDirectory) gDirectory->SaveObjectAs(this,filename,option);
697 return;
698 }
699
700 //==============Save object as a C, ROOT independant, file===================
701 if (filename && strstr(filename,".cc")) {
702 TString fname;
703 if (filename && strlen(filename) > 0) {
704 fname = filename;
705 } else {
706 fname.Form("%s.cc", GetName());
707 }
708 std::ofstream out;
709 out.open(fname.Data(), std::ios::out);
710 if (!out.good ()) {
711 Error("SaveAs", "cannot open file: %s", fname.Data());
712 return;
713 }
714 ((TObject*)this)->SavePrimitive(out,"cc");
715 out.close();
716 Info("SaveAs", "cc file: %s has been generated", fname.Data());
717 return;
718 }
719
720 //==============Save as a C++ CINT file======================================
721 TString fname;
722 if (filename && strlen(filename) > 0) {
723 fname = filename;
724 } else {
725 fname.Form("%s.C", GetName());
726 }
727 std::ofstream out;
728 out.open(fname.Data(), std::ios::out);
729 if (!out.good ()) {
730 Error("SaveAs", "cannot open file: %s", fname.Data());
731 return;
732 }
733 out <<"{"<<std::endl;
734 out <<"//========= Macro generated from object: "<<GetName()<<"/"<<GetTitle()<<std::endl;
735 out <<"//========= by ROOT version"<<gROOT->GetVersion()<<std::endl;
736 ((TObject*)this)->SavePrimitive(out,option);
737 out <<"}"<<std::endl;
738 out.close();
739 Info("SaveAs", "C++ Macro file: %s has been generated", fname.Data());
740}
741
742////////////////////////////////////////////////////////////////////////////////
743/// Save a primitive as a C++ statement(s) on output stream "out".
744
745void TObject::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
746{
747 out << "//Primitive: " << GetName() << "/" << GetTitle()
748 <<". You must implement " << ClassName() << "::SavePrimitive" << std::endl;
749}
750
751////////////////////////////////////////////////////////////////////////////////
752/// Set drawing option for object. This option only affects
753/// the drawing style and is stored in the option field of the
754/// TObjOptLink supporting a TPad's primitive list (TList).
755/// Note that it does not make sense to call object.SetDrawOption(option)
756/// before having called object.Draw().
757
759{
760 if (!gPad || !option) return;
761
762 TListIter next(gPad->GetListOfPrimitives());
763 delete gPad->FindObject("Tframe");
764 while (auto obj = next())
765 if (obj == this) {
766 next.SetOption(option);
767 return;
768 }
769}
770
771////////////////////////////////////////////////////////////////////////////////
772/// Set or unset the user status bits as specified in f.
773
775{
776 if (set)
777 SetBit(f);
778 else
779 ResetBit(f);
780}
781
782////////////////////////////////////////////////////////////////////////////////
783/// Set the unique object id.
784
786{
787 fUniqueID = uid;
788}
789
790////////////////////////////////////////////////////////////////////////////////
791/// Set current style settings in this object
792/// This function is called when either TCanvas::UseCurrentStyle
793/// or TROOT::ForceStyle have been invoked.
794
796{
797}
798
799////////////////////////////////////////////////////////////////////////////////
800/// Write this object to the current directory.
801/// The data structure corresponding to this object is serialized.
802/// The corresponding buffer is written to the current directory
803/// with an associated key with name "name".
804///
805/// Writing an object to a file involves the following steps:
806///
807/// - Creation of a support TKey object in the current directory.
808/// The TKey object creates a TBuffer object.
809///
810/// - The TBuffer object is filled via the class::Streamer function.
811///
812/// - If the file is compressed (default) a second buffer is created to
813/// hold the compressed buffer.
814///
815/// - Reservation of the corresponding space in the file by looking
816/// in the TFree list of free blocks of the file.
817///
818/// - The buffer is written to the file.
819///
820/// Bufsize can be given to force a given buffer size to write this object.
821/// By default, the buffersize will be taken from the average buffer size
822/// of all objects written to the current file so far.
823///
824/// If a name is specified, it will be the name of the key.
825/// If name is not given, the name of the key will be the name as returned
826/// by GetName().
827///
828/// The option can be a combination of: kSingleKey, kOverwrite or kWriteDelete
829/// Using the kOverwrite option a previous key with the same name is
830/// overwritten. The previous key is deleted before writing the new object.
831/// Using the kWriteDelete option a previous key with the same name is
832/// deleted only after the new object has been written. This option
833/// is safer than kOverwrite but it is slower.
834/// NOTE: Neither kOverwrite nor kWriteDelete reduces the size of a TFile--
835/// the space is simply freed up to be overwritten; in the case of a TTree,
836/// it is more complicated. If one opens a TTree, appends some entries,
837/// then writes it out, the behaviour is effectively the same. If, however,
838/// one creates a new TTree and writes it out in this way,
839/// only the metadata is replaced, effectively making the old data invisible
840/// without deleting it. TTree::Delete() can be used to mark all disk space
841/// occupied by a TTree as free before overwriting its metadata this way.
842/// The kSingleKey option is only used by TCollection::Write() to write
843/// a container with a single key instead of each object in the container
844/// with its own key.
845///
846/// An object is read from the file into memory via TKey::Read() or
847/// via TObject::Read().
848///
849/// The function returns the total number of bytes written to the file.
850/// It returns 0 if the object cannot be written.
851
852Int_t TObject::Write(const char *name, Int_t option, Int_t bufsize) const
853{
855 return 0;
856
857 TString opt = "";
858 if (option & kSingleKey) opt += "SingleKey";
859 if (option & kOverwrite) opt += "OverWrite";
860 if (option & kWriteDelete) opt += "WriteDelete";
861
862 if (gDirectory)
863 return gDirectory->WriteTObject(this,name,opt.Data(),bufsize);
864
865 const char *objname = name ? name : GetName();
866 Error("Write","The current directory (gDirectory) is null. The object (%s) has not been written.",objname);
867 return 0;
868}
869
870////////////////////////////////////////////////////////////////////////////////
871/// Write this object to the current directory. For more see the
872/// const version of this method.
873
875{
876 return ((const TObject*)this)->Write(name, option, bufsize);
877}
878
879////////////////////////////////////////////////////////////////////////////////
880/// Stream an object of class TObject.
881
883{
884 if (IsA()->CanIgnoreTObjectStreamer()) return;
885 UShort_t pidf;
886 if (R__b.IsReading()) {
887 R__b.SkipVersion(); // Version_t R__v = R__b.ReadVersion(); if (R__v) { }
888 R__b >> fUniqueID;
889 R__b >> fBits;
890 fBits |= kIsOnHeap; // by definition de-serialized object is on heap
891 if (TestBit(kIsReferenced)) {
892 //if the object is referenced, we must read its old address
893 //and store it in the ProcessID map in gROOT
894 R__b >> pidf;
895 pidf += R__b.GetPidOffset();
896 TProcessID *pid = R__b.ReadProcessID(pidf);
897 if (pid) {
898 UInt_t gpid = pid->GetUniqueID();
899 if (gpid>=0xff) {
900 fUniqueID = fUniqueID | 0xff000000;
901 } else {
902 fUniqueID = ( fUniqueID & 0xffffff) + (gpid<<24);
903 }
904 pid->PutObjectWithID(this);
905 }
906 }
907 } else {
909 if (!TestBit(kIsReferenced)) {
910 R__b << fUniqueID;
911 R__b << fBits;
912 } else {
913 //if the object is referenced, we must save its address/file_pid
914 UInt_t uid = fUniqueID & 0xffffff;
915 R__b << uid;
916 R__b << fBits;
918 //add uid to the TRefTable if there is one
920 if(table) table->Add(uid, pid);
921 pidf = R__b.WriteProcessID(pid);
922 R__b << pidf;
923 }
924 }
925}
926
927////////////////////////////////////////////////////////////////////////////////
928/// Interface to ErrorHandler (protected).
929
930void TObject::DoError(int level, const char *location, const char *fmt, va_list va) const
931{
932 const char *classname = "UnknownClass";
933 if (TROOT::Initialized())
934 classname = ClassName();
935
936 ::ErrorHandler(level, Form("%s::%s", classname, location), fmt, va);
937}
938
939////////////////////////////////////////////////////////////////////////////////
940/// Issue info message. Use "location" to specify the method where the
941/// warning occurred. Accepts standard printf formatting arguments.
942
943void TObject::Info(const char *location, const char *va_(fmt), ...) const
944{
945 va_list ap;
946 va_start(ap, va_(fmt));
947 DoError(kInfo, location, va_(fmt), ap);
948 va_end(ap);
949}
950
951////////////////////////////////////////////////////////////////////////////////
952/// Issue warning message. Use "location" to specify the method where the
953/// warning occurred. Accepts standard printf formatting arguments.
954
955void TObject::Warning(const char *location, const char *va_(fmt), ...) const
956{
957 va_list ap;
958 va_start(ap, va_(fmt));
959 DoError(kWarning, location, va_(fmt), ap);
960 va_end(ap);
961 if (TROOT::Initialized())
962 gROOT->Message(1001, this);
963}
964
965////////////////////////////////////////////////////////////////////////////////
966/// Issue error message. Use "location" to specify the method where the
967/// error occurred. Accepts standard printf formatting arguments.
968
969void TObject::Error(const char *location, const char *va_(fmt), ...) const
970{
971 va_list ap;
972 va_start(ap, va_(fmt));
973 DoError(kError, location, va_(fmt), ap);
974 va_end(ap);
975 if (TROOT::Initialized())
976 gROOT->Message(1002, this);
977}
978
979////////////////////////////////////////////////////////////////////////////////
980/// Issue system error message. Use "location" to specify the method where
981/// the system error occurred. Accepts standard printf formatting arguments.
982
983void TObject::SysError(const char *location, const char *va_(fmt), ...) const
984{
985 va_list ap;
986 va_start(ap, va_(fmt));
987 DoError(kSysError, location, va_(fmt), ap);
988 va_end(ap);
989 if (TROOT::Initialized())
990 gROOT->Message(1003, this);
991}
992
993////////////////////////////////////////////////////////////////////////////////
994/// Issue fatal error message. Use "location" to specify the method where the
995/// fatal error occurred. Accepts standard printf formatting arguments.
996
997void TObject::Fatal(const char *location, const char *va_(fmt), ...) const
998{
999 va_list ap;
1000 va_start(ap, va_(fmt));
1001 DoError(kFatal, location, va_(fmt), ap);
1002 va_end(ap);
1003 if (TROOT::Initialized())
1004 gROOT->Message(1004, this);
1005}
1006
1007////////////////////////////////////////////////////////////////////////////////
1008/// Use this method to implement an "abstract" method that you don't
1009/// want to leave purely abstract.
1010
1011void TObject::AbstractMethod(const char *method) const
1012{
1013 Warning(method, "this method must be overridden!");
1014}
1015
1016////////////////////////////////////////////////////////////////////////////////
1017/// Use this method to signal that a method (defined in a base class)
1018/// may not be called in a derived class (in principle against good
1019/// design since a child class should not provide less functionality
1020/// than its parent, however, sometimes it is necessary).
1021
1022void TObject::MayNotUse(const char *method) const
1023{
1024 Warning(method, "may not use this method");
1025}
1026
1027////////////////////////////////////////////////////////////////////////////////
1028/// Use this method to declare a method obsolete. Specify as of which version
1029/// the method is obsolete and as from which version it will be removed.
1030
1031void TObject::Obsolete(const char *method, const char *asOfVers, const char *removedFromVers) const
1032{
1033 const char *classname = "UnknownClass";
1034 if (TROOT::Initialized())
1035 classname = ClassName();
1036
1037 ::Obsolete(Form("%s::%s", classname, method), asOfVers, removedFromVers);
1038}
1039
1040////////////////////////////////////////////////////////////////////////////////
1041/// Get status of object stat flag.
1042
1044{
1045 return fgObjectStat;
1046}
1047////////////////////////////////////////////////////////////////////////////////
1048/// Turn on/off tracking of objects in the TObjectTable.
1049
1051{
1052 fgObjectStat = stat;
1053}
1054
1055////////////////////////////////////////////////////////////////////////////////
1056/// Return destructor only flag
1057
1059{
1060 return fgDtorOnly;
1061}
1062
1063////////////////////////////////////////////////////////////////////////////////
1064/// Set destructor only flag
1065
1067{
1068 fgDtorOnly = (Longptr_t) obj;
1069}
1070
1071////////////////////////////////////////////////////////////////////////////////
1072/// Operator delete
1073
1074void TObject::operator delete(void *ptr)
1075{
1076 if ((Longptr_t) ptr != fgDtorOnly)
1078 else
1079 fgDtorOnly = 0;
1080}
1081
1082////////////////////////////////////////////////////////////////////////////////
1083/// Operator delete []
1084
1085void TObject::operator delete[](void *ptr)
1086{
1087 if ((Longptr_t) ptr != fgDtorOnly)
1089 else
1090 fgDtorOnly = 0;
1091}
1092
1093#ifdef R__SIZEDDELETE
1094////////////////////////////////////////////////////////////////////////////////
1095/// Operator delete for sized deallocation.
1096
1097void TObject::operator delete(void *ptr, size_t size)
1098{
1099 if ((Longptr_t) ptr != fgDtorOnly)
1101 else
1102 fgDtorOnly = 0;
1103}
1104
1105////////////////////////////////////////////////////////////////////////////////
1106/// Operator delete [] for sized deallocation.
1107
1108void TObject::operator delete[](void *ptr, size_t size)
1109{
1110 if ((Longptr_t) ptr != fgDtorOnly)
1112 else
1113 fgDtorOnly = 0;
1114}
1115#endif
1116
1117////////////////////////////////////////////////////////////////////////////////
1118/// Print value overload
1119
1120std::string cling::printValue(TObject *val)
1121{
1122 std::ostringstream strm;
1123 strm << "Name: " << val->GetName() << " Title: " << val->GetTitle();
1124 return strm.str();
1125}
1126
1127#ifdef R__PLACEMENTDELETE
1128////////////////////////////////////////////////////////////////////////////////
1129/// Only called by placement new when throwing an exception.
1130
1131void TObject::operator delete(void *ptr, void *vp)
1132{
1133 TStorage::ObjectDealloc(ptr, vp);
1134}
1135
1136////////////////////////////////////////////////////////////////////////////////
1137/// Only called by placement new[] when throwing an exception.
1138
1139void TObject::operator delete[](void *ptr, void *vp)
1140{
1141 TStorage::ObjectDealloc(ptr, vp);
1142}
1143#endif
#define R__unlikely(expr)
Definition: RConfig.hxx:598
#define f(i)
Definition: RSha256.hxx:104
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Definition: RtypesCore.h:63
unsigned short UShort_t
Definition: RtypesCore.h:40
int Int_t
Definition: RtypesCore.h:45
long Longptr_t
Definition: RtypesCore.h:82
const Bool_t kFALSE
Definition: RtypesCore.h:101
unsigned int UInt_t
Definition: RtypesCore.h:46
float Float_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:100
unsigned long ULong_t
Definition: RtypesCore.h:55
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:375
#define gDirectory
Definition: TDirectory.h:384
constexpr Int_t kError
Definition: TError.h:46
void ErrorHandler(int level, const char *location, const char *fmt, std::va_list va)
General error handler function. It calls the user set error handler.
Definition: TError.cxx:112
constexpr Int_t kFatal
Definition: TError.h:49
constexpr Int_t kWarning
Definition: TError.h:45
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition: TError.cxx:188
constexpr Int_t kInfo
Definition: TError.h:44
constexpr Int_t kSysError
Definition: TError.h:48
Option_t Option_t option
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 b
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition: TGX11.cxx:110
R__EXTERN TGuiFactory * gGuiFactory
Definition: TGuiFactory.h:66
#define gInterpreter
Definition: TInterpreter.h:564
R__EXTERN TObjectTable * gObjectTable
Definition: TObjectTable.h:82
#define ATTRIBUTE_NO_SANITIZE_ADDRESS
Definition: TObject.cxx:62
Int_t gDebug
Definition: TROOT.cxx:585
#define gROOT
Definition: TROOT.h:405
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition: TString.cxx:2468
#define gPad
Definition: TVirtualPad.h:302
#define va_(arg)
Definition: Varargs.h:41
#define snprintf
Definition: civetweb.c:1540
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Buffer base class used for serializing objects.
Definition: TBuffer.h:43
virtual TProcessID * ReadProcessID(UShort_t pidf)=0
Return the current Process-ID.
Definition: TBuffer.cxx:344
virtual UShort_t WriteProcessID(TProcessID *pid)=0
Always return 0 (current processID).
Definition: TBuffer.cxx:353
virtual UShort_t GetPidOffset() const =0
Bool_t IsReading() const
Definition: TBuffer.h:86
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual void SkipVersion(const TClass *cl=nullptr)=0
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:81
void Draw(Option_t *option="") override
Draw detailed class inheritance structure.
Definition: TClass.cxx:2487
void * DynamicCast(const TClass *base, void *obj, Bool_t up=kTRUE)
Cast obj of this class type up to baseclass cl if up is true.
Definition: TClass.cxx:4904
static Int_t AutoBrowse(TObject *obj, TBrowser *browser)
Browse external object inherited from TObject.
Definition: TClass.cxx:1966
void Dump() const override
Dump contents of object on stdout.
Definition: TClass.h:396
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4863
virtual TInspectorImp * CreateInspectorImp(const TObject *obj, UInt_t width, UInt_t height)
Create a batch version of TInspectorImp.
Iterator of linked list.
Definition: TList.h:191
Option_t * GetOption() const override
Returns the object option stored in the list.
Definition: TList.cxx:1142
void SetOption(Option_t *option)
Sets the object option stored in the list.
Definition: TList.cxx:1151
Each ROOT class (see TClass) has a linked list of methods.
Definition: TMethod.h:38
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
const char * GetTitle() const override
Returns title of object.
Definition: TNamed.h:48
An array of TObjects.
Definition: TObjArray.h:31
static void AddObj(TObject *obj)
Add an object to the global object table gObjectTable.
void RemoveQuietly(TObject *obj)
Remove an object from the object table.
Mother of all ROOT objects.
Definition: TObject.h:41
void AbstractMethod(const char *method) const
Use this method to implement an "abstract" method that you don't want to leave purely abstract.
Definition: TObject.cxx:1011
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition: TObject.cxx:555
virtual void Inspect() const
Dump contents of this object in a graphics canvas.
Definition: TObject.cxx:546
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Computes distance from point (px,py) to the object.
Definition: TObject.cxx:265
static void SetObjectStat(Bool_t stat)
Turn on/off tracking of objects in the TObjectTable.
Definition: TObject.cxx:1050
virtual Bool_t Notify()
This method must be overridden to handle object notification.
Definition: TObject.cxx:588
virtual Bool_t IsEqual(const TObject *obj) const
Default equal comparison (objects are equal if they have the same address in memory).
Definition: TObject.cxx:565
@ kOverwrite
overwrite existing object with same name
Definition: TObject.h:92
@ kSingleKey
write collection with single key
Definition: TObject.h:91
@ kWriteDelete
write object, then delete previous key with same name
Definition: TObject.h:93
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:439
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
Definition: TObject.cxx:198
virtual void Dump() const
Dump contents of object on stdout.
Definition: TObject.cxx:348
UInt_t fUniqueID
object unique identifier
Definition: TObject.h:44
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:201
virtual const char * GetIconName() const
Returns mime type name of object.
Definition: TObject.cxx:449
virtual void RecursiveRemove(TObject *obj)
Recursively remove this object from a list.
Definition: TObject.cxx:653
virtual void DoError(int level, const char *location, const char *fmt, va_list va) const
Interface to ErrorHandler (protected).
Definition: TObject.cxx:930
virtual Bool_t HandleTimer(TTimer *timer)
Execute action in response of a timer timing out.
Definition: TObject.cxx:493
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition: TObject.cxx:223
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition: TObject.cxx:457
@ kIsOnHeap
object is on heap
Definition: TObject.h:81
UInt_t fBits
bit field status word
Definition: TObject.h:45
static Longptr_t fgDtorOnly
object for which to call dtor only (i.e. no delete)
Definition: TObject.h:47
virtual void Streamer(TBuffer &)
Stream an object of class TObject.
Definition: TObject.cxx:882
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
Definition: TObject.cxx:983
R__ALWAYS_INLINE Bool_t IsOnHeap() const
Definition: TObject.h:152
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:207
virtual void UseCurrentStyle()
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyl...
Definition: TObject.cxx:795
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
Definition: TObject.cxx:423
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:955
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:1022
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
Definition: TObject.cxx:299
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to an event at (px,py).
Definition: TObject.cxx:393
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition: TObject.cxx:403
static TClass * Class()
virtual void Execute(const char *method, const char *params, Int_t *error=nullptr)
Execute method on this object with the given parameter string, e.g.
Definition: TObject.cxx:359
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:184
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
Definition: TObject.cxx:468
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TObject.cxx:745
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:874
@ kOnlyPrepStep
Used to request that the class specific implementation of TObject::Write just prepare the objects to ...
Definition: TObject.h:106
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save this object in the file specified by filename.
Definition: TObject.cxx:680
virtual void Delete(Option_t *option="")
Delete this object.
Definition: TObject.cxx:248
static Longptr_t GetDtorOnly()
Return destructor only flag.
Definition: TObject.cxx:1058
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:774
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:525
static Bool_t GetObjectStat()
Get status of object stat flag.
Definition: TObject.cxx:1043
virtual void Copy(TObject &object) const
Copy this to obj.
Definition: TObject.cxx:140
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:969
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
Definition: TObject.cxx:758
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:997
static void SetDtorOnly(void *obj)
Set destructor only flag.
Definition: TObject.cxx:1066
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Definition: TObject.cxx:785
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:483
virtual void DrawClass() const
Draw class inheritance tree of the class to which this object belongs.
Definition: TObject.cxx:289
virtual TClass * IsA() const
Definition: TObject.h:245
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
Definition: TObject.cxx:238
virtual ~TObject()
TObject destructor.
Definition: TObject.cxx:158
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:274
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
Definition: TObject.cxx:601
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition: TObject.cxx:630
virtual void Pop()
Pop on object drawn in a pad to the top of the display list.
Definition: TObject.cxx:610
virtual ULong_t Hash() const
Return hash value for this object.
Definition: TObject.cxx:515
virtual void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
Definition: TObject.cxx:574
static Bool_t fgObjectStat
if true keep track of objects in TObjectTable
Definition: TObject.h:48
void ResetBit(UInt_t f)
Definition: TObject.h:200
@ kCanDelete
if object in a list can be deleted
Definition: TObject.h:62
@ kIsReferenced
if object is referenced by a TRef or TRefArray
Definition: TObject.h:65
@ kMustCleanup
if object destructor must call RecursiveRemove()
Definition: TObject.h:64
virtual Int_t Read(const char *name)
Read contents of object with specified name from the current directory.
Definition: TObject.cxx:642
static void AddToTObjectTable(TObject *)
Private helper function which will dispatch to TObjectTable::AddObj.
Definition: TObject.cxx:175
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:943
void Obsolete(const char *method, const char *asOfVers, const char *removedFromVers) const
Use this method to declare a method obsolete.
Definition: TObject.cxx:1031
A TProcessID identifies a ROOT job in a unique way in time and space.
Definition: TProcessID.h:74
void PutObjectWithID(TObject *obj, UInt_t uid=0)
stores the object at the uid th slot in the table of objects The object uniqued is set as well as its...
Definition: TProcessID.cxx:383
static TProcessID * GetProcessWithUID(const TObject *obj)
static function returning a pointer to TProcessID with its pid encoded in the highest byte of obj->Ge...
Definition: TProcessID.cxx:297
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
Definition: TROOT.cxx:2834
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition: TROOT.cxx:2819
A TRefTable maintains the association between a referenced object and the parent object supporting th...
Definition: TRefTable.h:35
static TRefTable * GetRefTable()
Static function returning the current TRefTable.
Definition: TRefTable.cxx:287
virtual Int_t Add(Int_t uid, TProcessID *context=nullptr)
Add a new uid to the table.
Definition: TRefTable.cxx:88
static void ObjectDealloc(void *vp)
Used to deallocate a TObject on the heap (via TObject::operator delete()).
Definition: TStorage.cxx:363
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition: TString.cxx:671
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2335
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
small helper class to store/restore gPad context in TPad methods
Definition: TVirtualPad.h:61
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
bool DeleteChangesMemory()
Definition: TObject.cxx:127
bool DeleteChangesMemoryImpl()
Definition: TObject.cxx:76
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.
Definition: TROOT.h:394