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