Re: [ROOT] Nested classes

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu May 31 2001 - 13:20:01 MEST


Did you test the macros on nested, nested, nested classes?

Cheers, Fons.



Christian Holm Christensen wrote:
> 
> Hi René,
> 
> On Wed, 30 May 2001 15:47:40 +0000
> Rene Brun <Rene.Brun@cern.ch> wrote
> concerning ": Re: [ROOT] Nested classes":
> > Hi Christian,
> >
> > Several mods are required in a few places in the ROOT classes to
> > support nested classes.
> 
> The first modification that is needed and can nested classes work with
> IO and interactive access, is what I described in
> 
>    http://root.cern.ch/root/roottalk/roottalk01/1561.html
>    http://root.cern.ch/root/roottalk/roottalk01/1562.html
> 
> I.e., a new ClassDefNested macro that doesn't contain the
> 
>   friend operartor <<(TBuffer, <class>)
> 
> since CINT chokes on it.  As I said in the mails cited above, I'm not
> really sure wether it's a CINT or ROOT problem.
> 
> However, you can easily put in that macro now, and nested class will
> almost work, it's really only the MakeProject thing that fails.
> 
> Perhaps the macro should be
> 
>   #define ClassDefNested(mother, child,id) \
>   private: \
>      static TClass *fgIsA; \
>   public: \
>      static  TClass*     MotherClass() { return mother::Class(); }
>      static  TClass*     Class(); \
>      static  const char* Class_Name(); \
>      static  Version_t   Class_Version() { return id; } \
>      static  void        Dictionary(); \
>      virtual TClass*     IsA() const { return child::Class(); } \
>      virtual void        ShowMembers(TMemberInspector &insp, char *parent); \
>      virtual void        Streamer(TBuffer &b); \
>      void                StreamerNVirtual(TBuffer &b) {name::Streamer(b);} \
>      _ClassInit_(chlid) \
>      static const char*  DeclFileName() { return __FILE__; } \
>      static int          DeclFileLine() { return __LINE__; } \
>      static const char*  ImplFileName(); \
>      static int          ImplFileLine();
> 
> or something.
> 
> > In particular, the information must be saved in the dictionary &
> > StreamerInfo.
> 
> For IO and interactive use, what is there now, the above is fine I
> believe.  In the emails cited above, I define a nested class, and I
> can easily use that in an interactive sesssion, as well as write it to
> a TTree using a TClonesArray and so on.
> 
> > Also MakeProject must be modified to take this case into account. I
> > have no plans to implement these changes in the short term.
> 
> To the best of my knowledge, it's only for this particular thing that
> the above schema fails.
> 
> I hope you'll consider putting in the macro above, at least for now,
> and then perhaps change the TStreamerInfo, TDictionary, etc. classes
> later on.  I believe nesting classes like this, is a very powerfull
> thing, since you can essentially say: "This data is really a
> sub-component of that data, and one should not access the one without
> the other". This is different from what Valeri did with TTables.
> 
> I'd love to discuss these matters with you at ROOT 2001, but
> unfortunally I'm not going (too little time), so it'll have to be via
> email.
> 
> Yours,
> 
> Christian  -----------------------------------------------------------
> Holm Christensen                             Phone:  (+45) 35 35 96 91
>   Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305
>   DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm
>   Denmark                                    Email:       cholm@nbi.dk

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:47 MET