Re: potential problem with generation of Class::Streamer function

Pasha Murat (murat@cdfsga.fnal.gov)
Sat, 25 Oct 1997 18:44:11 GMT


Hello,

the reported problem seems to be a bug: it I uppercase the file name
(Lrid.hh -> LRID.hh) and tell rootcint to generate LinkDef.h automatically
it generates LRID::Streamer() correctly...

Regards, Pasha.
--------------------------------------------------------------------------------
Pasha Murat writes:
>
>
> Enclosed below is an example of simple class representing a YBOS (YBOS=Zebra')
> bank, which is derived from TObject and contains an array of integers of
> fixed length. For some reason the Streamer method generated by rootcint
> saves/restores only TObject and pretends to know nothing about the array
> itself...
>
> Is it the expected behaviour and one should write Streamer by hands in this case
> or i'm just missing a way to tell rootcint about my object correctly?
>
> Thanks a lot , Pasha
>
> -------------------------------------------------- Lrid.hh
> #ifndef __LRID_HH__
> #define __LRID_HH__
> #include "TObject.h"
>
> class YBOS_BANK;
>
> int const LRID_DATA_SIZE = 8;
>
> class LRID: public TObject {
> protected:
> Int_t fWord[LRID_DATA_SIZE];
> public:
> LRID();
> LRID(YBOS_BANK& bank);
> virtual ~LRID();
> Int_t Word(int i) { return fWord[i]; }
> ClassDef(LRID,1)
> };
>
> #ifdef __CINT__
> #pragma link C++ class LRID;
> #endif
> #endif //__LRID_HH__
> -------------------------------------------------- LinkDef.h
> #ifdef __CINT__
> #pragma link off all globals;
> #pragma link off all classes;
> #pragma link off all functions;
> #endif
> -----------------------------------------------------------------------------
>
>
>
> > rootcint -f lrid.cxx -c -I$ROOTSYS/include -I../include inc/LinkDef.h Lrid.hh
> Warning: Link requested for undefined class YBOS_BANK FILE: LINE:0
> Class YBOS_BANK: Streamer() not declared
> Class YBOS_BANK: ShowMembers() not declared
>
> ********************** and here goes the output of rootcint (lrid.cxx)
> //
> // File generated by rootcint at Sat Oct 25 12:56:55 1997.
> // Do NOT change. Changes will be lost next time file is generated
> //
>
> #include "TBuffer.h"
> #include "TMemberInspector.h"
> #include "TError.h"
>
> //______________________________________________________________________________
> TBuffer &operator>>(TBuffer &buf, LRID *&obj)
> {
> // Read a pointer to an object of class LRID.
>
> obj = (LRID *) buf.ReadObject(LRID::Class());
> return buf;
> }
>
> //______________________________________________________________________________
> void LRID::Streamer(TBuffer &R__b)
> {
> // Stream an object of class LRID.
>
> TObject::Streamer(R__b);
> }
>
> //______________________________________________________________________________
> void LRID::ShowMembers(TMemberInspector &R__insp, char *R__parent)
> {
> // Inspect the data members of an object of class LRID.
>
> TClass *R__cl = LRID::IsA();
> Int_t R__ncp = strlen(R__parent);
> R__insp.Inspect(R__cl, R__parent, "fWord[8]", fWord);
> TObject::ShowMembers(R__insp, R__parent);
> }