29 #if !defined(WIN32) && !defined(__MWERKS__) && !defined(R__SOLARIS)
108 gROOT->MakeDefCanvas();
110 if (!
gPad->IsEditable())
return;
112 gPad->GetListOfPrimitives()->Add(
this,option);
130 return IsA()->GetName();
149 Fatal(
"Clone",
"No gDirectory set");
226 if (!newobj)
return 0;
232 if (padsav) padsav->
cd();
235 if (strlen(option)) newobj->
Draw(option);
237 if (padsav) padsav->
cd();
283 gInterpreter->Execute(
this, IsA(), method, params, error);
285 if (
gPad && must_cleanup)
gPad->Modified();
301 gInterpreter->Execute(
this, IsA(), method, params, error);
303 if (
gPad && must_cleanup)
gPad->Modified();
343 if (!
gPad)
return "";
347 while ((obj = next())) {
348 if (obj ==
this)
return next.
GetOption();
359 return IsA()->GetName();
388 if (!
gPad)
return (
char*)
"";
389 static char info[64];
403 return IsA()->GetTitle();
436 const void *ptr =
this;
445 return IsA()->InheritsFrom(classname);
453 return IsA()->InheritsFrom(cl);
495 std::cout <<
"OBJ: " << IsA()->GetName() <<
"\t" <<
GetName() <<
"\t" <<
GetTitle() <<
" : ";
497 if (option && strstr(option,
"noaddr")==0) {
498 std::cout <<
" at: "<< this ;
500 std::cout << std::endl;
532 if (
this ==
gPad->GetListOfPrimitives()->Last())
return;
536 while ((obj = next()))
538 char *opt =
StrDup(next.GetOption());
539 gPad->GetListOfPrimitives()->Remove((
TObject*)
this);
540 gPad->GetListOfPrimitives()->AddLast(
this, opt);
552 std::cout <<
"OBJ: " << IsA()->GetName() <<
"\t" <<
GetName() <<
"\t" <<
GetTitle() << std::endl;
602 if (filename && strstr(filename,
".root")) {
608 if (filename && strstr(filename,
".xml")) {
614 if (filename && strstr(filename,
".json")) {
620 if (filename && strstr(filename,
".cc")) {
622 if (filename && strlen(filename) > 0) {
623 fname = (
char*)filename;
628 out.open(fname, std::ios::out);
630 Error(
"SaveAs",
"cannot open file: %s", fname);
633 ((
TObject*)
this)->SavePrimitive(out,
"cc");
635 Info(
"SaveAs",
"cc file: %s has been generated", fname);
641 if (filename && strlen(filename) > 0) {
642 fname = (
char*)filename;
647 out.open(fname, std::ios::out);
649 Error(
"SaveAs",
"cannot open file: %s", fname);
652 out <<
"{"<<std::endl;
653 out <<
"//========= Macro generated from object: "<<
GetName()<<
"/"<<
GetTitle()<<std::endl;
654 out <<
"//========= by ROOT version"<<
gROOT->GetVersion()<<std::endl;
655 ((
TObject*)
this)->SavePrimitive(out,option);
656 out <<
"}"<<std::endl;
658 Info(
"SaveAs",
"C++ Macro file: %s has been generated", fname);
667 <<
". You must implement " <<
ClassName() <<
"::SavePrimitive" << std::endl;
679 if (!
gPad || !option)
return;
682 delete gPad->FindObject(
"Tframe");
684 while ((obj = next()))
686 next.SetOption(option);
773 const char *objname =
"no name specified";
774 if (name) objname =
name;
776 Error(
"Write",
"The current directory (gDirectory) is null. The object (%s) has not been written.",objname);
787 return ((
const TObject*)
this)->Write(name, option, bufsize);
793 void TObject::Streamer(
TBuffer &R__b)
795 if (IsA()->CanIgnoreTObjectStreamer())
return;
811 fUniqueID = fUniqueID | 0xff000000;
813 fUniqueID = ( fUniqueID & 0xffffff) + (gpid<<24);
825 UInt_t uid = fUniqueID & 0xffffff;
831 if(table) table->
Add(uid, pid);
843 const char *classname =
"UnknownClass";
857 va_start(ap,
va_(fmt));
869 va_start(ap,
va_(fmt));
873 gROOT->Message(1001,
this);
883 va_start(ap,
va_(fmt));
887 gROOT->Message(1002,
this);
897 va_start(ap,
va_(fmt));
901 gROOT->Message(1003,
this);
911 va_start(ap,
va_(fmt));
915 gROOT->Message(1004,
this);
924 Warning(method,
"this method must be overridden!");
935 Warning(method,
"may not use this method");
942 void TObject::Obsolete(
const char *method,
const char *asOfVers,
const char *removedFromVers)
const
944 const char *classname =
"UnknownClass";
948 ::Obsolete(
Form(
"%s::%s", classname, method), asOfVers, removedFromVers);
985 void TObject::operator
delete(
void *ptr)
987 if ((
Long_t) ptr != fgDtorOnly)
996 void TObject::operator
delete[](
void *ptr)
998 if ((
Long_t) ptr != fgDtorOnly)
1004 #ifdef R__SIZEDDELETE
1008 void TObject::operator
delete(
void *ptr,
size_t size)
1010 if ((
Long_t) ptr != fgDtorOnly)
1019 void TObject::operator
delete[](
void *ptr,
size_t size)
1021 if ((
Long_t) ptr != fgDtorOnly)
1032 std::ostringstream strm;
1037 #ifdef R__PLACEMENTDELETE
1041 void TObject::operator
delete(
void *ptr,
void *vp)
1049 void TObject::operator
delete[](
void *ptr,
void *vp)
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
UInt_t fUniqueID
object unique identifier
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...
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Computes distance from point (px,py) to the object.
virtual ULong_t Hash() const
Return hash value for this object.
write object, then delete previous key with same name
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...
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
static void SetDtorOnly(void *obj)
Set destructor only flag.
Buffer base class used for serializing objects.
static void SetObjectStat(Bool_t stat)
Turn on/off tracking of objects in the TObjectTable.
overwrite existing object with same name
void RemoveQuietly(TObject *obj)
Remove an object from the object table.
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
virtual Int_t Add(Int_t uid, TProcessID *context=0)
Add a new uid to the table.
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save this object in the file specified by filename.
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad...
virtual void UseCurrentStyle()
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyl...
virtual UShort_t GetPidOffset() const =0
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual Bool_t IsEqual(const TObject *obj) const
Default equal comparison (objects are equal if they have the same address in memory).
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
static Long_t GetDtorOnly()
Return destructor only flag.
if object in a list can be deleted
virtual void RecursiveRemove(TObject *obj)
Recursively remove this object from a list.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
const char * Data() const
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
static Long_t fgDtorOnly
object for which to call dtor only (i.e. no delete)
virtual void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual TProcessID * ReadProcessID(UShort_t pidf)=0
Return the current Process-ID.
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
virtual Bool_t Notify()
This method must be overridden to handle object notification.
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
virtual Bool_t HandleTimer(TTimer *timer)
Execute action in response of a timer timing out.
virtual void Inspect() const
Dump contents of this object in a graphics canvas.
R__ALWAYS_INLINE Bool_t IsOnHeap() const
virtual void Pop()
Pop on object drawn in a pad to the top of the display list.
virtual Option_t * GetOption() const
virtual Int_t Read(const char *name)
Read contents of object with specified name from the current directory.
virtual const char * GetIconName() const
Returns mime type name of object.
A TProcessID identifies a ROOT job in a unique way in time and space.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
R__EXTERN TGuiFactory * gGuiFactory
virtual UShort_t WriteProcessID(TProcessID *pid)=0
Always return 0 (current processID).
object has not been deleted
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Copy(TObject &object) const
Copy this to obj.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
virtual void Delete(Option_t *option="")
Delete this object.
Using a TBrowser one can browse all ROOT objects.
std::string printValue(const TDatime *val)
Print a TDatime at the prompt.
static TProcessID * GetProcessWithUID(const TObject *obj)
static function returning a pointer to TProcessID with its pid encoded in the highest byte of obj->Ge...
write collection with single key
virtual void DrawClass() const
Draw class inheritance tree of the class to which this object belongs.
virtual void Execute(const char *method, const char *params, Int_t *error=0)
Execute method on this object with the given parameter string, e.g.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void DoError(int level, const char *location, const char *fmt, va_list va) const
Interface to ErrorHandler (protected).
char * Form(const char *fmt,...)
void AbstractMethod(const char *method) const
Use this method to implement an "abstract" method that you don't want to leave purely abstract...
Handles synchronous and a-synchronous timer events.
virtual TInspectorImp * CreateInspectorImp(const TObject *obj, UInt_t width, UInt_t height)
Create a batch version of TInspectorImp.
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
The ROOT global object gROOT contains a list of all defined classes.
virtual TList * GetListOfPrimitives() const =0
static Bool_t GetObjectStat()
Get status of object stat flag.
if object destructor must call RecursiveRemove()
static void AddObj(TObject *obj)
Add an object to the global object table gObjectTable.
R__EXTERN TObjectTable * gObjectTable
char * StrDup(const char *str)
Duplicate the string str.
UInt_t fBits
bit field status word
virtual void Modified(Bool_t flag=1)=0
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
void Obsolete(const char *method, const char *asOfVers, const char *removedFromVers) const
Use this method to declare a method obsolete.
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
static Bool_t fgObjectStat
if true keep track of objects in TObjectTable
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to an event at (px,py).
virtual const char * GetName() const
Returns name of object.
static TRefTable * GetRefTable()
Static function returning the current TRefTable.
virtual ~TObject()
TObject destructor.
A TRefTable maintains the association between a referenced object and the parent object supporting th...
virtual UInt_t GetUniqueID() const
Return the unique object id.
Mother of all ROOT objects.
void ErrorHandler(int level, const char *location, const char *fmt, va_list va)
General error handler function. It calls the user set error handler.
virtual void Add(TObject *obj)
Each ROOT class (see TClass) has a linked list of methods.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
if object is referenced by a TRef or TRefArray
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
virtual const char * GetTitle() const
Returns title of object.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
static void ObjectDealloc(void *vp)
Used to deallocate a TObject on the heap (via TObject::operator delete()).
static Int_t AutoBrowse(TObject *obj, TBrowser *browser)
Browse external object inherited from TObject.
virtual void SkipVersion(const TClass *cl=0)=0
virtual void Dump() const
Dump contents of object on stdout.
static void AddToTObjectTable(TObject *)
Private helper function which will dispatch to TObjectTable::AddObj.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.