On 31 Jan 2000, Fons Rademakers wrote: > the example you gave looks simple but can quickly become quite complex, > which makes an automatic solution to solve the problem tricky. > > keep track of the object in a hashtable like is done in TBuffer, but > the implementation would be far from trivial (to cover all cases and > order in which things are read). > [...] > > > Anton Fokin wrote: > > > > > > > > Hi, > > > > > > > > I would like to stream a structure like this > > > > > > > > Obj1 *--> Obj <--* Obj2 > > > > > > > > where Obj1 and Obj2 have pointers to the same object Obj. If I stream it > > > in > > > > a "normal" way, Obj1::Streamer() will invoke Streamer() of Obj and > > > > Obj2::Streamer() will do the same. The same happens if I read it back, > > > i.e. > > > > I will get two copies of Obj. I could not find a solution except writing > > a > > > > numerical id instead of pointers and connecting object after reading. > > Any > > > > suggestions? [...] Additionally, one must not forget to define ownership. When I tried a similar thing, I noticed a memory leak, since ROOT creates Obj but does not care to delete it. An automatic solution would have to be in such a way that ROOT should take the ownership of these new objects, but give it away, as soon as an object (e.g. Obj/ClonesArray etc), which own Obj is loaded afterwards. Christoph -- Christoph Borgmeier Mail: DESY F15/HERA-B, Geb. 61/117 Notkestr. 85, 22607 Hamburg Humboldt Univ Berlin Phone: +49 40 8998 4850 Email: Christoph.Borgmeier@desy.de
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:18 MET