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