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