Re: [ROOT] cint problem with pointers-to-pointers

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Apr 04 2001 - 23:56:55 MEST


Hi Peter,
The code generated automatically by rootcint will only work for
objects derived from TObject or objects having the I/O operators >>, <<
defined.
If your ** is a list of pointers, Root has also no way no loop
on the list. With version 3.00/06, you can specify the length
of the array in the comment field of the member in case the length
is itself a class member. See an example at
 http://root.cern.ch/root/SchemaEvolution.html

I strongly suggest to use containers like TObjArray instead.

Rene Brun

On Wed, 4 Apr 2001, Peter Steinberg wrote:

> 
> hi root guys -
> 
> PHOBOS is trying to move to ROOT3, which is going well, but for
> a few hiccups.  here's one:
> 
> my class has a member:
> 
> class TPhMapSet
> {
> ...
>  TPhPadMap** fMaps;         // List of map pointers
> ...
> }
> 
> what i find in the rootcint generated code is a few things:
> 
> -------------------------------------------------------------------------
> 
> void TPhMapSet::ShowMembers(TMemberInspector &R__insp, char *R__parent)
> {
>    // Inspect the data members of an object of class TPhMapSet.
> ...
>    R__cl->SetStreamer("*fMaps",R__TPhMapSet_fMaps);  
> ...
> }
> 
> AND
> 
> void R__TPhMapSet_fMaps(TBuffer &R__b, void *R__p, int)
> {
>    TPhPadMap*** fMaps = (TPhPadMap***)R__p;
>    if (R__b.IsReading()) {
>       R__b >> *fMaps;
>    } else {
>       R__b << (TObject*)*fMaps;
>    }
> }
> 
> ------------------------------------------------------------------------
> 
> clearly the problem is that the compiler cannot find any function to match 
> 
>  R__b >> *fMaps;
> 
> the thing is that this problem does not occur in ROOT2.25.02, where
> in TPhMapSet::ShowMembers i get the code
> 
>  R__insp.Inspect(R__cl, R__parent, "*fMaps", &fMaps);
> 
> which is the same as the other members in the class, unlike the ROOT3
> version, which is different (i.e. with a SetStreamer).
> 
> Interestingly, this mechanism has no problems with basic types
> and ROOT classes.  do i need to add a new operator to my class, or
> can i fix this in the LinkDef?
> 
> Thanks,
> Peter
> 
> 
> ---------------------------------------------------------------------------
> Dr. Peter A. Steinberg			     Brookhaven National Laboratory
> Assistant Scientist                               Bldg 555, Upton NY, 11973
> Office: 631-344-4390			     mailto:Peter.Steinberg@bnl.gov
> Mobile: 917-549-3094                      http://www.rhic.bnl.gov/~steinber
> ---------------------------------------------------------------------------
> 
> 
> 



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