Hi,
I am trying to use the ROOT class reflection. I built a class named
'myclass'.
I list below my root session when playing with this class and the source
files for it.
My question is why I can get my integer variable by GETTER method but
can't get my float variable? Thanks!
-Wensheng
Here is my ROOT session
===============================================
*** Start at Date : 17-Jan-2000 Time : 12:6:35 ***
QAInfo:You are using STAR_LEVEL : new and ROOT_LEVEL : 2.23.10
root.exe [0] gSystem->Load("StRtti.so")
(int)0
root.exe [1] myclass *mc = new myclass()
root.exe [2] mc->SetMyInt(3)
root.exe [3] mc->SetMyFloat(3.5)
root.exe [4] TClass *mcc = mc->IsA()
root.exe [5] TDataMember *dmInt = mcc->GetDataMember("fMyInt")
root.exe [6] TMethodCall *getInt = dmInt->GetterMethod()
root.exe [7] TMethodCall *setInt = dmInt->SetterMethod()
root.exe [8] Long_t l
root.exe [11] getInt->Execute(mc,"",l)
root.exe [12] l
(Long_t)3
root.exe [13] TDataMember *dmFloat = mcc->GetDataMember("fMyFloat")
root.exe [14] TMethodCall *getFloat = dmFloat->GetterMethod()
root.exe [15] TMethodCall *SetFloat = dmFloat->SetterMethod()
root.exe [16] Double_t d
root.exe [17] getFloat->Execute(mc,"",d)
root.exe [18] d
(Double_t)0.00000000000000000e+00
root.exe [19]
Here is hh file --- myclass.hh
===============================================
#ifndef myclass_hh
#define myclass_hh
#include "TObject.h"
class myclass:public TObject {
public:
Int_t GetMyInt();
void SetMyInt(Int_t i);
Float_t GetMyFloat();
void SetMyFloat(Float_t f);
private:
Int_t fMyInt;
Float_t fMyFloat;
ClassDef(myclass,1)
};
#endif
Here is cc file
==============================================
#include "myclass.hh"
ClassImp(myclass)
Int_t myclass::GetMyInt() {
return fMyInt;
}
void myclass::SetMyInt(Int_t i) {
fMyInt = i;
}
Float_t myclass::GetMyFloat() {
return fMyFloat;
}
void myclass::SetMyFloat(Float_t f) {
fMyFloat = f;
}
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:17 MET