Dear Experts,
I wanted to write my own streamer for a class which has pointer to array. Nothing is derived from TObject. I also wanted to use genreflex.
Here is my simple class A:
class A {
public:
int m_n;
A():m_n(7){}
virtual ~A();
ClassDef(A,1);
};
genreflex (gendict.py from 5.23, others from 5.22a. This is to avoid a problem with vector. ) produces the streamer like this.
void ::Streamer(TBuffer &b) {
if (b.IsReading()) {
b.ReadClassBuffer(::Class(),this);
} else {
b.WriteClassBuffer(::Class(),this);
}
}
and rootcint produces:
void A::Streamer(TBuffer &R__b)
{
// Stream an object of class A.
UInt_t R__s, R__c;
if (R__b.IsReading()) {
Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
R__b >> m_n;
R__b.CheckByteCount(R__s, R__c, A::IsA());
} else {
R__c = R__b.WriteVersion(A::IsA(), kTRUE);
R__b << m_n;
R__b.SetByteCount(R__c, kTRUE);
}
}
I copied rootcint version and pasted into A_rflx.cxx which is produced with genreflex. When I write and read the tfile, I get the following error.
Error in TBufferFile::CheckByteCount: object of class A read too few bytes: 6 instead of 10
once per event. If I use genreflex generated streamer, I don’t get such error.
How can I use (something like) rootcint generated Streamer with genreflex? This is because I would like to read/write class members by myself.
I can also remove the error if I remove calls to ReadVersion, CheckByteCount, WriteVersion and SetByteCount functions in rootcint generated streamer.
I use 5.22a version of root except for gendict.py which is from 5.23
It happens even if I use 5.22a version of gendict.py
Thanks!
Nobu