34 class TInspectorObject :
public TObject 38 TInspectorObject(
void *obj,
TClass *cl) : fObj(obj),fClass(cl) {};
39 ~TInspectorObject(){;}
41 void *GetObject()
const {
return fObj; };
45 TClass *IsA()
const {
return fClass; }
78 :
TCanvas(
"inspect",
"ROOT Object Inspector",ww,wh)
115 const Int_t kname = 1;
116 const Int_t kvalue = 25;
117 const Int_t ktitle = 37;
118 const Int_t kline = 1024;
124 TInspectorObject *proxy=0;
128 proxy = (TInspectorObject*)obj;
129 obj = (
TObject*)proxy->GetObject();
138 if (nreal == 0)
return;
141 if (nreal+7 > nrows) nrows = nreal+7;
148 canvas->
Range(0,-3,20,nreal+4);
156 if (tsize < 0.02) tsize = 0.02;
157 if (tsize > 0.03) tsize = 0.03;
160 TText tname, tvalue, ttitle;
188 fBackward =
new TButton(
"backward",
"TInspectCanvas::GoBackward();",.01,btop-db,.15,btop);
191 fForward =
new TButton(
"forward",
"TInspectCanvas::GoForward();", .21,btop-db,.35,btop);
206 frame.
DrawLine(xvalue, y1, xvalue, y3);
207 frame.
DrawLine(xtitle, y1, xtitle, y3);
210 ttitle.
DrawText(0.5*(x1+xvalue), y2+0.1,
"Member Name");
211 ttitle.
DrawText(0.5*(xvalue+xtitle), y2+0.1,
"Value");
212 ttitle.
DrawText(0.5*(xtitle+x2), y2+0.1,
"Title");
219 strlcpy(line,obj->
GetName(),kline);
220 ttitle.
DrawText(xvalue+0.2, y3+0.1, line);
225 snprintf(line,1023,
"%s:%d",
"Foreign object",0);
226 ttitle.
DrawText(xvalue+0.2, y3+0.1, line);
228 ttitle.
DrawText(xtitle+2, y3+0.1,
"no title given");
238 for (
Int_t pass = 0; pass < 3; pass++) {
243 if (!member)
continue;
255 pname = &line[kname];
256 for (
Int_t i=0;i<kline;i++) line[i] =
' ';
258 strlcpy(pname,rd->
GetName(),kline-kname);
259 if (strstr(member->
GetFullTypeName(),
"**")) strlcat(pname,
"**",kline-kname);
264 char *pointer = (
char*)obj + offset;
265 char **ppointer = (
char**)(pointer);
274 char **p3pointer = (
char**)(*ppointer);
277 p3pointer = (
char**)
new TInspectorObject(p3pointer,clm);
281 snprintf(&line[kvalue],kline-kvalue,
"->0");
282 }
else if (!member->
IsBasic()) {
284 tlink =
new TLink(xvalue+0.1, ytext, p3pointer);
286 }
else if (membertype) {
288 strlcpy(&line[kvalue], *ppointer,kline-kvalue);
290 strlcpy(&line[kvalue], membertype->
AsString(p3pointer),kline-kvalue);
293 strlcpy(&line[kvalue], *ppointer,kline-kvalue);
295 if (pass == 1) tlink =
new TLink(xvalue+0.1, ytext, p3pointer);
297 }
else if (membertype)
299 cdatime = (
UInt_t*)pointer;
301 snprintf(&line[kvalue],kline-kvalue,
"%d/%d",cdate,ctime);
305 strlcpy(&line[kvalue], membertype->
AsString(pointer),kline-kvalue);
315 if (lentit >= kline-ktitle) lentit = kline-ktitle-1;
316 strlcpy(&line[ktitle],member->
GetTitle(),kline-ktitle);
317 line[ktitle+lentit] = 0;
322 if (pass == 0)tname.
DrawText( x1+0.1, ytext, &line[kname]);
335 tval->
DrawText(xvalue+0.1, ytext, &line[kvalue]);
338 if (pass == 2 && ltit) ttitle.
DrawText(xtitle+0.3, ytext, &line[ltit]);
352 if (!inspect)
return;
364 if (!inspect)
return;
385 if (padsav) padsav->
cd();
virtual const char * GetName() const
Returns name of object.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
TList * fObjects
List of objects inspected.
TString GetTypeName()
Get basic type of typedef, e,g.
const char * GetFullTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
All ROOT classes may have RTTI (run time type identification) support added.
TInspectCanvas()
InspectCanvas default constructor.
virtual void SetName(const char *name)
Set the name of the TNamed.
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
const char * GetTypeName() const
Get type of data member, e,g.: "class TDirectory*" -> "TDirectory".
virtual TLine * DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
virtual TObject * FindObject(const char *name) const
Search if object named name is inside this pad or in pads inside this pad.
Bool_t IsStartingWithTObject() const
Returns true if this class inherits from TObject and if the start of the TObject parts is at the very...
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual ~TInspectCanvas()
InspectCanvas default destructor.
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from a pad and its sub-pads.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
if object in a list can be deleted
virtual void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this pad.
TList * GetObjects() const
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
static const double x2[5]
virtual TVirtualPad * GetVirtCanvas() const
Get virtual canvas.
Int_t fLogx
(=0 if X linear scale, =1 if log scale)
static void GetDateTime(UInt_t datetime, Int_t &date, Int_t &time)
Static function that returns the date and time.
Long_t GetThisOffset() const
Base class for several text objects.
TDataType * GetDataType() const
TVirtualPad is an abstract base class for the Pad and Canvas classes.
R__EXTERN TGuiFactory * gGuiFactory
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
void BuildRealData(void *pointer=0, Bool_t isTransient=kFALSE)
Build a full list of persistent data members.
TButton * fForward
Pointer to the Forward button.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Basic data type descriptor (datatype information is obtained from CINT).
static void GoForward()
static function , inspect next object
virtual TObject * Remove(TObject *obj)
Remove object from the list.
UInt_t GetWh() const
Get Wh.
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
TDataMember * GetDataMember() const
virtual void Inspect() const
Dump contents of this object in a graphics canvas.
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
virtual void Clear(Option_t *option="")=0
TButton * fBackward
Pointer to the Backward button.
virtual TInspectorImp * CreateInspectorImp(const TObject *obj, UInt_t width, UInt_t height)
Create a batch version of TInspectorImp.
The TRealData class manages the effective list of all data members for a given class.
The ROOT global object gROOT contains a list of all defined classes.
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
TObject * GetCurObject() const
virtual void InspectObject(TObject *obj)
Dump contents of obj in a graphics canvas.
virtual void SetCanvasSize(UInt_t ww, UInt_t wh)=0
static const double x1[5]
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)=0
TList * GetListOfRealData() const
virtual void Clear(Option_t *option="")
Remove all objects from the list.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Mother of all ROOT objects.
const char * AsString(void *buf) const
Return string containing value in buffer formatted according to the basic data type.
virtual const char * GetTitle() const
Returns title of object.
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
static void Inspector(TObject *obj)
static function , interface to InspectObject.
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from the list of objects.
virtual void Add(TObject *obj)
TObject * fCurObject
Pointer to object being inspected.
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
virtual void Update()
Update canvas pad buffers.
A TInspectCanvas is a canvas specialized to inspect Root objects.
virtual const char * GetName() const
Returns name of object.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual const char * GetName() const
Returns name of object.
static void GoBackward()
static function , inspect previous object
TClass * GetClass() const
Bool_t IsaPointer() const
Return true if data member is a pointer.
Int_t fLogy
(=0 if Y linear scale, =1 if log scale)
virtual const char * GetTitle() const
Returns title of object.
Special TText object used to show hyperlinks.