RE:Extension to class G__ClassInfo?

Masaharu Goto (MXJ02154@nifty.ne.jp)
Sat, 19 Sep 1998 08:36:00 +0900


Stefan,

>I saw in the code for rootcint that it uses the cint class G__ClassInfo to
>obtain information about the class it is writing code for. I think the
>cleanest way to add template support into rootcint would be to add three
>new member functions to G__ClassInfo:

>// Return true if it is a template class, false otherwise
>long G__ClassInfo::IsTemplate()
>The test could perhaps be simply based on the classname, e.g. if it
>contains a matching pair of "<" and ">".
>// Return the base of the class name (for bla<T> return "bla"):
>const char* G__ClassInfo::TmplName()

This should be easy.

>// Return the template argument (for bla<T> return "T"):
>const char* G__ClassInfo::TmplArg()

How about you have multiple template arguments? bla<T,E>. Should TmplArg
return "T,E" or do you want to iterate to get T and E separately?

>The existence of these would allow to handle the generation of code for
>template classes in rootcint in a clean way.
>Do you think that this could be provided?

Yes, I think so. And there are alternatives.

1) Add above feature in G__ClassInfo
2) Use adapter class to add above feature. In this case you can extend the
capability by yourself.

class G__TmpltClassInfo : public G__ClassInfo {
public:
int IsTemplate();
char* TmplName();
char* TmplArg();
};

In above senario, the only information you need is G__ClassInfo::Name(). All
of the other information can be created from it.

Tell me your preference.

Masaharu Goto