[ROOT] Problem reading a TRef'd object

From: John Pretz (pretz@umdgrb.umd.edu)
Date: Wed Jan 07 2004 - 22:25:40 MET


Hello everybody.

I'm trying out TRef and I ran into the following problem:
I have a class ClassA and a class ClassB.  ClassB has a TRef to ClassA.  I 
want to write them both to disk.  I do it two possible ways.  One works.  
The other doesn't.
If I 
1.) Create ClassA
2.) Create ClassB
3.) Make ClassB::fTRef point to ClassA
4.) Write ClassA and ClassB to file
alls well, and I can read them both back in just fine.

If however, I do this:
1.) Create ClassA
2.) Write ClassA to file
3.) Create ClassB and make it's TRef point to ClassA
4.) Write ClassB to file
I read in ClassA and ClassB only to find that ClassB's TRef points to 0.

Is there a way to make this work for me?  I would really like to be able 
to write ClassA to file before even creating the object that will point to 
it.  I hunted around on this list's archives and couldn't find any 
solutions.

I included some code.  Just 'make' should compile all the code and run my 
problem scripts.  (I'm using ROOT 3.10.02 on a RedHat 9 machine)

Thanks in advance.

John 

-- 
---------------Visit my webpage!---------------------
---------http://umdgrb.umd.edu/pretz-----------------





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