Re: [ROOT] Streaming templated containers of pointers to disk (Modified by troy d straszheim)

From: Fons Rademakers (
Date: Fri Jul 30 2004 - 02:29:15 MEST

Hi Troy,

  if you remove the //-> comments from the 3 pointers (t, t_left,
t_right) then it works fine and you see that datum 3 is stored and read
only once.

With the //-> specification the program comes in and infite loop till
the stack is exhausted. To be protected.

Cheers, Fons.

On Tue, 2004-07-27 at 19:17, troy d straszheim wrote:
> Hi roottalk-
> I have a problem, I can't get a class to stream.  This another step in 
> the road of getting those boost::shared_ptr<> classes to work.  I'm 
> almost there, I just need to see that classes that point to one another 
> via these shared pointers can get to/from root files OK.
> Here' s an example that I think shows the problem.  There is a template 
> class, Container<T>, which contains a pointer to a T, and two pointers 
> to containers of T, one "left" and one "right".
> The idea is to establish that the automatically generated streamers 
> properly handle situations where some object is pointed to more than 
> once.  We create a "diamond pattern", like this:
>        C0
>      /      \
>    C1    C2
>      \      /
>       C3
> and then ask C0 to Write() itself to disk, with the intention of 
> checking later that all three objects are written and that C1 and C2 
> point to the same object (c3)
> Unfortunately my test case crashes on OSX and on Linux (with root about 
> 2 weeks old), during the Write() somewhere.  I can't seem to see what's 
> wrong, hopefully I just need a fresh pair of eyes.... any ideas?
> Run (via ACLiC) with "root -b streamtest.cxx++"
> ______________________________________________________________________
> Thanks,
> Troy Straszhei	
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail:              Phone: +41 22 7679248
WWW:      Fax:   +41 22 7679480

This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET