Hello Rooters,
I have a problem in a standalone application with a user-defined class, serialized in a ROOT file, which I extended later.
But let me start with the beginning:
I wrote a user definied class, say FooBar (see below), fitted it with the ClassDef-/ClassImp-macros and generated a dictonary with rootcint and a LinkDef.h.
public class FooBar : public TObject {
private:
TString mFoo;
public
FooBar();
FooBar( const FooBar& pCopyMe );
~FooBar();
FooBar& operator=( const pAssignMe );
inline void setFoo( const TString& pFoo ) { mFoo = pFoo; }
inline const TString& getFoo() const { return mFoo; }
ClassDef( FooBar, 1 );
}
For each day of the year I create a new root-file, generate a branch with a TClonesArray, fill the TClonesArray with n objects of type “FooBar”, put it to the buffer and write the buffer to the file. When I had to read all the things back from file to memory for some analysis, it all worked great.
One fine day (=yesterday) it was necessary to extend my class FooBar. Like this:
public class FooBar : public TObject {
private:
TString mBar;
TString mFoo;
public
FooBar();
FooBar( const FooBar& pCopyMe );
~FooBar();
FooBar& operator=( const pAssignMe );
inline void setBar( const TString& pBar ) { mBar = pBar; }
inline void setFoo( const TString& pFoo ) { mFoo = pFoo; }
inline const TString& getBar() const { return mBar; }
inline const TString& getFoo() const { return mFoo; }
ClassDef( FooBar, 2 );
}
I did all I’ve learned. Extended the class with new members and functions, counted up the ClassDef-Version, generated a new dictionary. Surprisingly I cannot read back the values I stored with setBar() in my object. All I get is an empty TString.
Any ideas what I might have done wrong?
H.-Gerd
Tech-Stuff: Still using ROOT 3.05/07 on Fedora Linux (Core 2) with gcc 3.3.3