Robert Casties wrote: > > ..since the automatic splitting does not work (AFAIK) on objects > containing pointers to simple types. > > I have a raw data object containing variable length byte arrays. I wanted > to allocate the maximum space before and then only copy every event into > that space. (I didn't want to use TArray -- seems sorta overkill) > We cannot do an automatic split in case a data member is a pointer to a fundamental type, say: Float_t *x We do not know the length of this array. Very likely one of your data members contains this length, but we do not know its position. To implement your solution where you want to read your arrays always at the same address, I suggest a small class class myArray ; public TObject { Int_t n; //length of array Float_t *rx; //!pointer to some static array } Note the character "!" as first character of the comment field for *rx. This character instructs rootcint that you do not want this member to be persistent. You must now implement your own version of myArray::Streamer(TBuffer &buf) { if (buf.IsReading()) { buf >> n; buf.ReadFastArray(rx,n); } else { buf << n; buf.WriteFastArray(rx,n); } } Now in your Event class, you can have myArray *a1; myArray *a2; etc You must take care of initializing once the pointers rx for your myArray objects. Rene Brun
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:22 MET