|
ROOT
Reference Guide |
|
Go to the documentation of this file.
29 #if !defined(WIN32) && !defined(__MWERKS__) && !defined(R__SOLARIS)
110 gROOT->MakeDefCanvas();
112 if (!
gPad->IsEditable())
return;
114 gPad->GetListOfPrimitives()->Add(
this,option);
132 return IsA()->GetName();
152 return gROOT->CloneObject(
this);
228 if (!newobj)
return 0;
234 if (padsav) padsav->
cd();
237 if (strlen(option)) newobj->
Draw(option);
239 if (padsav) padsav->
cd();
285 gInterpreter->Execute(
this, IsA(), method, params, error);
287 if (
gPad && must_cleanup)
gPad->Modified();
303 gInterpreter->Execute(
this, IsA(), method, params, error);
305 if (
gPad && must_cleanup)
gPad->Modified();
345 if (!
gPad)
return "";
349 while ((obj = next())) {
350 if (obj ==
this)
return next.
GetOption();
361 return IsA()->GetName();
390 if (!
gPad)
return (
char*)
"";
391 static char info[64];
405 return IsA()->GetTitle();
438 const void *ptr =
this;
447 return IsA()->InheritsFrom(classname);
455 return IsA()->InheritsFrom(cl);
497 std::cout <<
"OBJ: " << IsA()->GetName() <<
"\t" <<
GetName() <<
"\t" <<
GetTitle() <<
" : ";
499 if (option && strstr(option,
"noaddr")==0) {
500 std::cout <<
" at: "<< this ;
502 std::cout << std::endl;
534 if (
this ==
gPad->GetListOfPrimitives()->Last())
return;
538 while ((obj = next()))
541 gPad->GetListOfPrimitives()->Remove((
TObject*)
this);
542 gPad->GetListOfPrimitives()->AddLast(
this, opt);
554 std::cout <<
"OBJ: " << IsA()->GetName() <<
"\t" <<
GetName() <<
"\t" <<
GetTitle() << std::endl;
604 if (filename && strstr(filename,
".root")) {
610 if (filename && strstr(filename,
".xml")) {
616 if (filename && strstr(filename,
".json")) {
622 if (filename && strstr(filename,
".cc")) {
624 if (filename && strlen(filename) > 0) {
630 out.open(fname.
Data(), std::ios::out);
632 Error(
"SaveAs",
"cannot open file: %s", fname.
Data());
635 ((
TObject*)
this)->SavePrimitive(out,
"cc");
637 Info(
"SaveAs",
"cc file: %s has been generated", fname.
Data());
643 if (filename && strlen(filename) > 0) {
649 out.open(fname.
Data(), std::ios::out);
651 Error(
"SaveAs",
"cannot open file: %s", fname.
Data());
654 out <<
"{"<<std::endl;
655 out <<
"//========= Macro generated from object: "<<
GetName()<<
"/"<<
GetTitle()<<std::endl;
656 out <<
"//========= by ROOT version"<<
gROOT->GetVersion()<<std::endl;
657 ((
TObject*)
this)->SavePrimitive(out,option);
658 out <<
"}"<<std::endl;
660 Info(
"SaveAs",
"C++ Macro file: %s has been generated", fname.
Data());
669 <<
". You must implement " <<
ClassName() <<
"::SavePrimitive" << std::endl;
681 if (!
gPad || !option)
return;
684 delete gPad->FindObject(
"Tframe");
686 while ((obj = next()))
786 const char *objname =
"no name specified";
789 Error(
"Write",
"The current directory (gDirectory) is null. The object (%s) has not been written.",objname);
800 return ((
const TObject*)
this)->Write(
name, option, bufsize);
806 void TObject::Streamer(
TBuffer &R__b)
808 if (IsA()->CanIgnoreTObjectStreamer())
return;
844 if(table) table->
Add(uid, pid);
856 const char *classname =
"UnknownClass";
870 va_start(ap,
va_(fmt));
882 va_start(ap,
va_(fmt));
886 gROOT->Message(1001,
this);
896 va_start(ap,
va_(fmt));
900 gROOT->Message(1002,
this);
910 va_start(ap,
va_(fmt));
914 gROOT->Message(1003,
this);
924 va_start(ap,
va_(fmt));
928 gROOT->Message(1004,
this);
937 Warning(method,
"this method must be overridden!");
948 Warning(method,
"may not use this method");
955 void TObject::Obsolete(
const char *method,
const char *asOfVers,
const char *removedFromVers)
const
957 const char *classname =
"UnknownClass";
961 ::Obsolete(
Form(
"%s::%s", classname, method), asOfVers, removedFromVers);
998 void TObject::operator
delete(
void *ptr)
1009 void TObject::operator
delete[](
void *ptr)
1017 #ifdef R__SIZEDDELETE
1021 void TObject::operator
delete(
void *ptr,
size_t size)
1032 void TObject::operator
delete[](
void *ptr,
size_t size)
1044 std::string cling::printValue(
TObject *val) {
1045 std::ostringstream strm;
1050 #ifdef R__PLACEMENTDELETE
1054 void TObject::operator
delete(
void *ptr,
void *vp)
1062 void TObject::operator
delete[](
void *ptr,
void *vp)
@ kMustCleanup
if object destructor must call RecursiveRemove()
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 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".
Using a TBrowser one can browse all ROOT objects.
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 void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
void SetOption(Option_t *option)
Sets the object option stored in the list.
static void AddObj(TObject *obj)
Add an object to the global object table gObjectTable.
R__EXTERN TObjectTable * gObjectTable
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 Int_t Compare(const TObject *obj) const
Compare abstract method.
const char * Data() const
char * Form(const char *fmt,...)
virtual const char * GetIconName() const
Returns mime type name of object.
virtual Int_t Add(Int_t uid, TProcessID *context=0)
Add a new uid to the table.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static void ObjectDealloc(void *vp)
Used to deallocate a TObject on the heap (via TObject::operator delete()).
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad...
A TProcessID identifies a ROOT job in a unique way in time and space.
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Option_t * GetOption() const
Returns the object option stored in the list.
virtual UInt_t GetUniqueID() const
Return the unique object id.
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
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 ULong_t Hash() const
Return hash value for this object.
Buffer base class used for serializing objects.
virtual const char * GetTitle() const
Returns title of object.
void Obsolete(const char *method, const char *asOfVers, const char *removedFromVers) const
Use this method to declare a method obsolete.
virtual Bool_t HandleTimer(TTimer *timer)
Execute action in response of a timer timing out.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void RecursiveRemove(TObject *obj)
Recursively remove this object from a list.
@ kOverwrite
overwrite existing object with same name
virtual void ls(Option_t *option="") const
The ls function lists the contents of a class on stdout.
virtual ~TObject()
TObject destructor.
virtual const char * GetName() const
Returns name of object.
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
static Int_t AutoBrowse(TObject *obj, TBrowser *browser)
Browse external object inherited from TObject.
Handles synchronous and a-synchronous timer events.
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
virtual void UseCurrentStyle()
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyl...
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save this object in the file specified by filename.
virtual Bool_t Notify()
This method must be overridden to handle object notification.
virtual void DoError(int level, const char *location, const char *fmt, va_list va) const
Interface to ErrorHandler (protected).
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Computes distance from point (px,py) to the object.
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
UInt_t fUniqueID
object unique identifier
static TProcessID * GetProcessWithUID(const TObject *obj)
static function returning a pointer to TProcessID with its pid encoded in the highest byte of obj->Ge...
Each ROOT class (see TClass) has a linked list of methods.
static TRefTable * GetRefTable()
Static function returning the current TRefTable.
virtual TList * GetListOfPrimitives() const =0
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.
@ kSingleKey
write collection with single key
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
#define R__unlikely(expr)
R__EXTERN TGuiFactory * gGuiFactory
static void SetObjectStat(Bool_t stat)
Turn on/off tracking of objects in the TObjectTable.
char * StrDup(const char *str)
Duplicate the string str.
virtual Bool_t IsEqual(const TObject *obj) const
Default equal comparison (objects are equal if they have the same address in memory).
static Longptr_t GetDtorOnly()
Return destructor only flag.
void AbstractMethod(const char *method) const
Use this method to implement an "abstract" method that you don't want to leave purely abstract.
static Bool_t fgObjectStat
if true keep track of objects in TObjectTable
virtual Int_t Read(const char *name)
Read contents of object with specified name from the current directory.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
@ kCanDelete
if object in a list can be deleted
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
@ kOnlyPrepStep
Used to request that the class specific implementation of TObject::Write just prepare the objects to ...
static void SetDtorOnly(void *obj)
Set destructor only flag.
A TRefTable maintains the association between a referenced object and the parent object supporting th...
virtual void Dump() const
Dump contents of object on stdout.
virtual void DrawClass() const
Draw class inheritance tree of the class to which this object belongs.
UInt_t fBits
bit field status word
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
@ kIsReferenced
if object is referenced by a TRef or TRefArray
@ kNotDeleted
object has not been deleted
virtual TInspectorImp * CreateInspectorImp(const TObject *obj, UInt_t width, UInt_t height)
Create a batch version of TInspectorImp.
virtual UShort_t WriteProcessID(TProcessID *pid)=0
Always return 0 (current processID).
@ kIsOnHeap
object is on heap
static Bool_t GetObjectStat()
Get status of object stat flag.
TClass instances represent classes, structs and namespaces in the ROOT type system.
virtual void SetDrawOption(Option_t *option="")
Set drawing option for object.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
virtual void Add(TObject *obj)
Mother of all ROOT objects.
virtual void Inspect() const
Dump contents of this object in a graphics canvas.
R__ALWAYS_INLINE Bool_t IsOnHeap() const
virtual void Delete(Option_t *option="")
Delete this object.
virtual void Modified(Bool_t flag=1)=0
virtual TProcessID * ReadProcessID(UShort_t pidf)=0
Return the current Process-ID.
virtual void SkipVersion(const TClass *cl=0)=0
virtual void Copy(TObject &object) const
Copy this to obj.
@ kWriteDelete
write object, then delete previous key with same name
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.
static Longptr_t fgDtorOnly
object for which to call dtor only (i.e. no delete)
virtual void Pop()
Pop on object drawn in a pad to the top of the display list.
void RemoveQuietly(TObject *obj)
Remove an object from the object table.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to an event at (px,py).
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.