28 #if !defined(WIN32) && !defined(__MWERKS__) && !defined(R__SOLARIS) 148 if (root ==
this)
return;
167 gROOT->MakeDefCanvas();
169 if (!
gPad->IsEditable())
return;
171 gPad->GetListOfPrimitives()->Add(
this,option);
189 return IsA()->GetName();
208 Fatal(
"Clone",
"No gDirectory set");
284 if (!newobj)
return 0;
290 if (padsav) padsav->
cd();
293 if (strlen(option)) newobj->
Draw(option);
295 if (padsav) padsav->
cd();
341 gInterpreter->Execute(
this, IsA(), method, params, error);
343 if (
gPad && must_cleanup)
gPad->Modified();
359 gInterpreter->Execute(
this, IsA(), method, params, error);
361 if (
gPad && must_cleanup)
gPad->Modified();
401 if (!
gPad)
return "";
405 while ((obj = next())) {
406 if (obj ==
this)
return next.
GetOption();
417 return IsA()->GetName();
446 if (!
gPad)
return (
char*)
"";
447 static char info[64];
450 snprintf(info,64,
"x=%g, y=%g",
gPad->PadtoX(x),
gPad->PadtoY(y));
461 return IsA()->GetTitle();
480 const void *ptr =
this;
489 return IsA()->InheritsFrom(classname);
497 return IsA()->InheritsFrom(cl);
539 std::cout <<
"OBJ: " << IsA()->GetName() <<
"\t" <<
GetName() <<
"\t" <<
GetTitle() <<
" : ";
541 if (option && strstr(option,
"noaddr")==0) {
542 std::cout <<
" at: "<< this ;
544 std::cout << std::endl;
576 if (
this ==
gPad->GetListOfPrimitives()->Last())
return;
580 while ((obj = next()))
582 char *opt =
StrDup(next.GetOption());
583 gPad->GetListOfPrimitives()->Remove((
TObject*)
this);
584 gPad->GetListOfPrimitives()->AddLast(
this, opt);
596 std::cout <<
"OBJ: " << IsA()->GetName() <<
"\t" <<
GetName() <<
"\t" <<
GetTitle() << std::endl;
646 if (filename && strstr(filename,
".root")) {
652 if (filename && strstr(filename,
".xml")) {
658 if (filename && strstr(filename,
".cc")) {
660 if (filename && strlen(filename) > 0) {
661 fname = (
char*)filename;
666 out.open(fname, std::ios::out);
668 Error(
"SaveAs",
"cannot open file: %s", fname);
671 ((
TObject*)
this)->SavePrimitive(out,
"cc");
673 Info(
"SaveAs",
"cc file: %s has been generated", fname);
679 if (filename && strlen(filename) > 0) {
680 fname = (
char*)filename;
685 out.open(fname, std::ios::out);
687 Error(
"SaveAs",
"cannot open file: %s", fname);
690 out <<
"{"<<std::endl;
691 out <<
"//========= Macro generated from object: "<<
GetName()<<
"/"<<
GetTitle()<<std::endl;
692 out <<
"//========= by ROOT version"<<
gROOT->GetVersion()<<std::endl;
693 ((
TObject*)
this)->SavePrimitive(out,option);
694 out <<
"}"<<std::endl;
696 Info(
"SaveAs",
"C++ Macro file: %s has been generated", fname);
705 <<
". You must implement " <<
ClassName() <<
"::SavePrimitive" << std::endl;
717 if (!
gPad || !option)
return;
720 delete gPad->FindObject(
"Tframe");
722 while ((obj = next()))
724 next.SetOption(option);
811 const char *objname =
"no name specified";
812 if (name) objname =
name;
814 Error(
"Write",
"The current directory (gDirectory) is null. The object (%s) has not been written.",objname);
825 return ((
const TObject*)
this)->Write(name, option, bufsize);
831 void TObject::Streamer(
TBuffer &R__b)
833 if (IsA()->CanIgnoreTObjectStreamer())
return;
849 fUniqueID = fUniqueID | 0xff000000;
851 fUniqueID = ( fUniqueID & 0xffffff) + (gpid<<24);
869 if(table) table->
Add(uid, pid);
881 const char *classname =
"UnknownClass";
895 va_start(ap,
va_(fmt));
907 va_start(ap,
va_(fmt));
911 gROOT->Message(1001,
this);
921 va_start(ap,
va_(fmt));
925 gROOT->Message(1002,
this);
935 va_start(ap,
va_(fmt));
939 gROOT->Message(1003,
this);
949 va_start(ap,
va_(fmt));
953 gROOT->Message(1004,
this);
962 Warning(method,
"this method must be overridden!");
973 Warning(method,
"may not use this method");
980 void TObject::Obsolete(
const char *method,
const char *asOfVers,
const char *removedFromVers)
const 982 const char *classname =
"UnknownClass";
986 ::Obsolete(
Form(
"%s::%s", classname, method), asOfVers, removedFromVers);
1023 void TObject::operator
delete(
void *ptr)
1034 void TObject::operator
delete[](
void *ptr)
1046 std::ostringstream strm;
1051 #ifdef R__PLACEMENTDELETE 1055 void TObject::operator
delete(
void *ptr,
void *vp)
1063 void TObject::operator
delete[](
void *ptr,
void *vp)
virtual void DoError(int level, const char *location, const char *fmt, va_list va) const
Interface to ErrorHandler (protected).
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual UInt_t GetUniqueID() const
Return the unique object id.
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 void Info(const char *method, const char *msgfmt,...) const
Issue info message.
ROOT top level object description.
virtual ULong_t Hash() const
Return hash value for this object.
TSeqCollection * GetListOfCleanups() const
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current pad.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Computes distance from point (px,py) to the object.
virtual const char * GetIconName() const
Returns mime type name of object.
Bool_t TestBit(UInt_t f) const
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.
static const char * filename()
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 void Draw(Option_t *option="")
Default Draw method for all objects.
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 void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
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.
virtual void RecursiveRemove(TObject *obj)
Recursively remove this object from a list.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual TProcessID * ReadProcessID(UShort_t pidf)=0
Return the current Process-ID.
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save this object in the file specified by filename.
virtual void Copy(TObject &object) const
Copy this to obj.
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 Pop()
Pop on object drawn in a pad to the top of the display list.
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 Int_t Read(const char *name)
Read contents of object with specified name from the current directory.
TObject & operator=(const TObject &rhs)
TObject assignment operator.
A TProcessID identifies a ROOT job in a unique way in time and space.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
R__EXTERN TGuiFactory * gGuiFactory
void Obsolete(const char *method, const char *asOfVers, const char *removedFromVers) const
Use this method to declare a method obsolete.
TObject()
TObject constructor.
virtual UShort_t WriteProcessID(TProcessID *pid)=0
Always return 0 (current processID).
virtual void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
virtual Bool_t IsEqual(const TObject *obj) const
Default equal comparison (objects are equal if they have the same address in memory).
virtual void DrawClass() const
Draw class inheritance tree of the class to which this object belongs.
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
std::string printValue(const TDatime &val)
Print a TDatime at the prompt.
R__EXTERN TROOT * gROOTLocal
virtual void Delete(Option_t *option="")
Delete this object.
Using a TBrowser one can browse all ROOT objects.
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
static TProcessID * GetProcessWithUID(const TObject *obj)
static function returning a pointer to TProcessID with its pid encoded in the highest byte of obj->Ge...
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 Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Inspect() const
Dump contents of this object in a graphics canvas.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
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
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
static Bool_t GetObjectStat()
Get status of object stat flag.
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.
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.
static Bool_t fgObjectStat
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to an event at (px,py).
static TRefTable * GetRefTable()
Static function returning the current TRefTable.
virtual void Dump() const
Dump contents of object on stdout.
virtual ~TObject()
TObject destructor.
A TRefTable maintains the association between a referenced object and the parent object supporting th...
virtual Option_t * GetOption() const
Mother of all ROOT objects.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual const char * GetTitle() const
Returns title of object.
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.
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
static Bool_t FilledByObjectAlloc(UInt_t *member)
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
virtual const char * GetName() const
Returns name of object.
void AbstractMethod(const char *method) const
Use this method to implement an "abstract" method that you don't want to leave purely abstract...
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 Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void SkipVersion(const TClass *cl=0)=0
const char * Data() const
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".