RE:Re: [ROOT] Problems accessing protected

From: Birger Koblitz (koblitz@mail.desy.de)
Date: Fri Jun 02 2000 - 19:50:12 MEST


Hi Masaharu,

thanks for the help and sorry for answering with so much delay, yesterday
was a public holiday in germany and I am using this for a prolonged
weekend. I implemented your solution right after Rene's hint and it works
fine. It is not really a problem that this functionallity is missing in
CINT. What was a little bit anoying was that I did not get any warning and
the code just crashed in a awy I did not understand. It really took some
time until I figured out that it was not me who was stupid.
All in all I think that CINT is a phantastic piece of work. Before I saw
it I thought that it was not even possible to write something like that.
Still I think it needs some work if it shall be bread for the masses. Not
so much in the functionallity, but in terms of fool proofness. I know that
its difficult to make a good program fool proof but Root is at a stage
where a lot of beginners in C++ are starting to use it and they will
certainly need some guidance by the interpreter when beginning to code.

Cheers,
  Birger

On Thu, 1 Jun 2000, Masaharu Goto wrote:

> Hello Birger,
> 
> Let me confirm the situation.
> 
> You have a precompiled class with protected data member  and an
> interpreted class which inherits from the precompiled class. 
> Protected data member is assigned in a member function of inherited
> class. If this is true, this is a ROOT/Cint limitation. You can not
> access protected member of a precompiled class from an interpreted 
> class.
> 
> This could be theoretically solved by generating stub sub-class for
> every precompiled class. However, this will double the size of dictionary.
> This is quite fundamental for a compiler independent C++ interprter.
> Please consider following workaround.
> 
> Workaround:
>   1. Compile the derived class also, at least, where you want to access
>     the protected member and virtual function.
>     (See example in demo/makecint/Stub2 in cint source package)
>   2. Add an access function to the protected member.
> 
> Thank you
> Masaharu Goto
> 
> P.S.
> 
> I happen to have some e-mail access during the trip. But the line
> is slow. Please do not expect much for a while.
> 
> 
> >
> >Hi Rene,
> >
> >thanks for your help. The solution you proposed seems to work. Anyway, the
> >problem remains that I was not able to write into the protected data
> >members of a class I derived from. This is a bug in CINT in case that I
> >did not do a stupid error and it seems I didnt!
> >If you have another look at the following lines, you can see that clearly
> >fX should have the value of fx in the second printout, which it does not
> >have.
> >-----------------------------------------------
> >  fx=(Float_t *)new Float_t[fN];
> >  fy=(Float_t *)new Float_t[fN];
> >  cout << "1.  " << fx << " " << fX << endl;
> >  fX=(Float_t *)fx; fY=(Float_t *)fy;
> >  cout << "2.  " << fx << " " << fX << endl;
> >-----------------------------------------------
> >Printout:
> >1.  0x209895b8 0xc8
> >2.  0x209895b8 0x209898e8   ??????????????????
> >-----------------------------------------------
> >My idea of the class was a polyline which automatically expands when
> >one adds a histo in a way that it is allways the convex hull of all the   
> >histograms passed to it. The reason for implementing it in this way is,
> >that there is no TGraph with asymetric errors which can be drawn as a
> >filled area. At least this is what I found in 2.24/02 and in some
> >statement on the rootlist quite some time ago.
> >
> >Again thanks for your quick help,
> >  Birger
> >
> >/------------------------------------------------------------\
> >| Birger Koblitz                    koblitz@mail.desy.de     |
> >| Max-Planck-Institut fuer Physik                            |
> >| (Werner Heisenberg-Institut)                               |
> >| DESY-FH1K                         Tel. (40) 8998-3971      |
> >| Notkestr. 85                                               |
> >| D-22603  HAMBURG                                           |
> >\------------------------------------------------------------/
> >
> 

/------------------------------------------------------------\
| Birger Koblitz                    koblitz@mail.desy.de     |
| Max-Planck-Institut fuer Physik                            |
| (Werner Heisenberg-Institut)                               |
| DESY-FH1K                         Tel. (40) 8998-3971      |
| Notkestr. 85                                               |
| D-22603  HAMBURG                                           |
\------------------------------------------------------------/



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