Re: [ROOT] Fixing automatic streamers

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jun 07 2004 - 09:58:25 MEST


Schema evolution will work if you replace the illegal N=0, by N=1 (see also my
previous mail)

Rene Brun

Salvatore Rappoccio wrote:
> 
> Hi, All,
> 
> I have a class that I have been allowing ROOT to generate Streamers for:
> 
> class X {
> 
>   X();
>   X( const X & );
> 
> private:
>   TH1F * x;
>   TH1F * y;
> 
>   ClassDef(X,1)
> };
> 
> Now, I need to extend the class to have an array for "x" and "y":
> 
> class X {
> 
>   X();
>   X( const X &);
> 
>   enum Number_t { N=0, N_NUMBER_TYPES };
> 
> private:
>   TH1F* x[N];
>   TH1F* y[N];
> 
>   ClassDef(X,2)
> };
> 
> Will the automatic Streamer generator be able to pick up this change? I
> imagine not. So if not, what is the order of the variables streamed in the
> automatic Streamer? Is there a version number written out? I imagine it to
> be:
> 
>   version >> x >> y;
> 
> but I can't really be sure. The automatic generation looks like:
> 
> void X::Streamer( TBuffer &R__b)
> {
>    // Stream an object of class X.
> 
>    if (R__b.IsReading()) {
>       X::Class()->ReadBuffer(R__b, this);
>    } else {
>       X::Class()->WriteBuffer(R__b, this);
>    }
> }
> 
> so I can't figure out the order of the objects read in and out are. After
> I know the order, it is of course trivial to write a streamer to handle
> both versions, but I can't figure out what the order is.
> 
> Thanks,
> Sal Rappoccio



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET