Re: Array of TObjArrays

From: Victor Perevoztchikov (perev@bnl.gov)
Date: Thu Mar 16 2000 - 16:34:16 MET


Hi Damir,

> I do not see why there is no default constructor in the TObjArray class.
> I thought this was necessary for streaming.

There is default constructor:

    TObjArray TObjArray(Int_t s = TCollection::kInitCapacity, Int_t lowerBound = 0)

most probably, that you have some inconsitency in shared libraries. Some of the
made with one version of .h file and other with another. linker does not check it.

The best way remove all .o .so files and remade it.

My proposal of TObjArray of TObjArray's was not a correction of your error,
but just proposal to simplify code.

Victor



           Damir Buskulic wrote:
> 
> Hi Victor,
> 
> My example worked perfectly until a few days ago when I tried to port it
> to gcc2.8.1.
> I do not see why there is no default constructor in the TObjArray class.
> I thought this was necessary for streaming.
> 
> Damir
> 
> Victor Perevoztchikov wrote:
> >
> > Hi Damir,
> > I do not see anything wrong in your example.
> > But if you will use TObjArray of TObjArray's then you will not need
> > special Streamer at all.
> >
> > Victor
> >
> > Damir Buskulic wrote:
> > >
> > > Hi,
> > >
> > > I have an array of TObjArrays that I want to stream. When I read the
> > > objects back, I have an error :
> > >
> > > Error in <TClass::New>: no default ctor for class TObjArray
> > > Error in <TBuffer::ReadObject>: could not create object of class
> > > TObjArray
> > > Warning in <TExMap::Remove>: key 2560 not found at 45
> > > Warning in <TBuffer::CheckObject>: reference to object of unavailable
> > > class TObjArray, pointer will be 0
> > >
> > > Program received signal SIGSEGV, Segmentation fault.
> > >
> > > This happens in the streamer of a class, here is the excerpt of the
> > > Streamer that does the job :
> > >
> > >       mFDNames = new TObjArray* [mCapacity];
> > >       memset(mFDNames, 0, mCapacity*sizeof(TObjArray*));
> > >       TObjArray* obj;
> > >       for (Int_t i=0; i<mCapacity;i++) {
> > >          R__b >> obj;
> > >          if (obj) mFDNames[i] = obj;
> > >       }
> > >
> > > It happens only on Alpha with gcc 2.8.1, but works fine on Alpha/egcs
> > > and LinuxPPC/egcs. What does this mean ? Should I do something special
> > > before R__b>>obj ?
> > >
> > > Cheers
> > >
> > > Damir
> > > --
> > > =====================================================================
> > > | Damir Buskulic                  | Universite de Savoie/LAPP       |
> > > |                                 | Chemin de Bellevue, B.P. 110    |
> > > | Tel : +33 (0)450091600          | F-74941 Annecy-le-Vieux Cedex   |
> > > | e-mail: buskulic@lapp.in2p3.fr  | FRANCE                          |
> > > =====================================================================
> > > mailto:buskulic@lapp.in2p3.fr
> >
> > --
> > Victor M. Perevoztchikov   perev@bnl.gov  perev@vxcern.cern.ch
> > Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
> > tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690
> 
> --
> =====================================================================
> | Damir Buskulic                  | Universite de Savoie/LAPP       |
> |                                 | Chemin de Bellevue, B.P. 110    |
> | Tel : +33 (0)450091600          | F-74941 Annecy-le-Vieux Cedex   |
> | e-mail: buskulic@lapp.in2p3.fr  | FRANCE                          |
> =====================================================================
> mailto:buskulic@lapp.in2p3.fr

-- 
Victor M. Perevoztchikov   perev@bnl.gov  perev@vxcern.cern.ch       
Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:21 MET