Re: Auto-documentation, Streamers, and virtual functions

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Feb 16 2000 - 21:38:00 MET


Hi George,
Your macro is OK. However, your point 2 is not correct.
Adding functions to a class cannot double the size of an instance,
unless you have only one instance of these classes.
You only increase the size of the VTBL.
I would be relunctant to increase the number of these macros.
We already introduced a set of macros for templates support.
This makes the life of beginners more difficult.

Rene Brun

On Wed, 16 Feb 2000, George Heintzelman wrote:

> 
> Hi, Rooters,
> 
> As Root currently stands, in order to use the automatic documentation 
> system one has to use the ClassDef() and ClassImp() macros. There are 
> classes for which this is an imposition, but also where you would 
> nevertheless like to have documentation available. The two cases in 
> particular are:
> 
> 1) Classes which should never be read and written, for which a Streamer 
> is declared (and if you are careless, auto-generated) anyway.
> 
> 2) Classes which wrap very small amounts of data, eg. smart pointers, 
> which do not have their own virtual functions and for which the 
> addition of the virtual functions IsA, ShowMembers and Streamer adds a 
> significant (up to a factor of 2) amount to the size of the object.
> 
> Looking carefully at the definitions of the macros, it appears that it 
> should be feasible to extract the parts needed for documentation 
> generation and use only those in a documentation generation. There are 
> two questions I want to ask:
> 
> 1) Will doing this create any unintended side effects? I am not 
> entirely familiar with all the ways Root uses its dictionary, so I am 
> unsure of this.
> 2) If not, could this be added to the Root distribution?
> 
> The only real change needed (as far as I can tell) is to write a 
> ClassDefDoc macro as a stripped-down ClassDef, which I've reproduced 
> here:
> 
> #define ClassDefDoc(name,id) \
> private: \
>   static TClass *fgIsA; \
> public: \
>    static const char *DeclFileName() { return __FILE__; } \
>    static int DeclFileLine() { return __LINE__; } \
>    static const char *ImplFileName(); \
>    static int ImplFileLine(); \
>    static Version_t Class_Version() { return id; } \
>    static TClass *Class(); \
>    static void Dictionary();
> 
> I've tried using this macro in a non-streamed class of mine, and as far 
> as I could tell everything worked correctly; the class was correctly 
> documented in the output.
> 
> George Heintzelman
> gah@bnl.gov
> 
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET