[ROOT] automatic schema evolution

From: Susan Kasahara (schubert@physics.umn.edu)
Date: Wed Nov 20 2002 - 05:31:15 MET


Hi roottalk,
I'm trying to understand automatic schema evolution in root.
I have used automatic schema evolution all along in generating
my files (old & new), using the '+' flag in the class pragma
statement in the LinkDef.h file to activate this.  I am having
a problem now when attempting to move a data member
from a derived class to a base class.
  When I read the documentation (root user manual version 3.02c),
I interpret the section on Schema Evolution to indicate that
root will map a persistent data member to one memory in the
event that a data member is moved from a derived class to a
base class, or vice versa.  But in tests I find that when I move
a data member to a base class, this mapping
doesn't seem to take place.  Instead the moved data member is simply
skipped on input.
  For example, if I move the fRun data member of the EventHeader
class in $ROOTSYS/test/Event.h to a new base class "RunHeader", e.g.
change the current:

class EventHeader  {

private:
    Int_t fEvtNum;
    Int_t fRun;
    Int_t fDate;
 public:
 ...
   ClassDef(EventHeader,1)
};

to:

class RunHeader {
 protected:
    Int_t fRun;

  public:
  ...
   ClassDef(RunHeader,1)
};

class EventHeader : public RunHeader {
 private:
   Int_t fEvent;
   Int_t fDate;
  public:
     ...
   ClassDef(EventHeader,2)
};

I find that using EventHeader version 2 I am able to read old files
that have been generated with EventHeader version 1, but the fRun
data member, now in the RunHeader base class, is not filled in
properly.

So, two questions:
1)Should I be able to move a data member to base class and expect
    root's schema evolution to be able to map this transition when
    reading old data files?
2)If not, how do I handle this mapping myself?

I am using cvs root from today with gcc 3.2 on linux.
Thanks for your help,
-Sue



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:20 MET