[ROOT] Writing if more than one list refs the same object.

From: Thomas Bretz (tbretz@uni-sw.gwdg.de)
Date: Wed Nov 14 2001 - 11:20:04 MET


Hi rooter,

think about the follwoing class and macro:

-----------------
class MyClass : public TObject
{
   TList *list1;
   TList *list2;

   void AddToList1(TObject *obj) { list1->Add(obj); }
   void AddToList2(TObject *obj) { list2->Add(obj); }
}

MyClass myc;

TNamed name1("name1", "");
TNamed name2("name2", "");
TNamed name3("name3", "");

myc.AddToList1(&name1);
myc.AddToList2(&name2);

myc.AddToList1(&name3);
myc.AddToList2(&name3);

-----------------

Now I want to store the object myc in a root-file, but I don't want to
store the object name3 twice. If I read back myc from the file I want to
have name3 only once in the memory. Is it possible with root to do this?

Thanks a lot,
Thomas.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:08 MET