In the tree there have a branch 'GetSelfObj() ’ and a leaf ‘GetHandle()’ as shown in the picture. And the branch 'GetSelfObj() ’ is an infinite recursion.
I do not want to include this two ‘member function’ in the tree.
[quote]I do not want to include this two ‘member function’ in the tree.[/quote]They are not ‘included’ in the TTree, they are ‘only’ presented in the TBrowser because they are function member of the class.
Cheers,
Philippe.
PS. Besides, it is like a design mistake to have such a method in your class definition (i.e. I don’t understand its purpose!)
I have another qustion, in the ‘TBoard’ class I have a lot of member functions, but why only this two functions were presented in the TBrowser?
[quote=“pcanal”]
PS. Besides, it is like a design mistake to have such a method in your class definition (i.e. I don’t understand its purpose!)[/quote]
I have several classes inherit from ‘TBoard’, my ideal is read a class name (char*) form a ‘txt’ file, and then use the TClass::New() to create an object. The ‘TBoard *’ pointer in the 'TBoard’class is used to add a ‘Branch’ to a ‘tree’, just as the following:
the ‘tboard’ is a pointer (TBoard *) point to different classes which is inherit form ‘TBoard’. Maybe this ideal is stupid, however this is the way which can I think out.
In you description and code snipper I see no difference between the value of ‘tborad’ and the value returned by GetSelfObj … I am guessing that you constructor contains something like: pSelfObj = this;?
I am guessing that you might have meant to have:virtual TBoard** GetSelfObj() const {return &pSelfObj;} so that you could pass the address of a pointer to Branch.
In modern version of ROOT, this is no longer necessary and thus the following might just work:tree->Branch("name", tborad->Class_Name(), tborad);
Cheers,
Philippe.
PS. However SetBranchAddress still requires the address of a pointer.