Re: [ROOT] Persistency of TClass*

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jul 31 2002 - 00:23:37 MEST


Hi Axel,

We already have a procedure to save the class structure on a file,
see TStreamerInfo. Do not try to write TClass yourself to a file.
The dictionary for all classes written to a file is automatically
written to the file when the file is closed.

Rene Brun


On Tue, 30 Jul 2002 axel@fnal.gov wrote:

> Hi,
> 
> writing a TClass to file works without any problems, it's just that the 
> read TClass is pretty much unusable. This makes kind of sense, as 
> TClass is more or less a static object. But there are some cases where 
> storing a TClass* would be helpful, e.g.: A map from TClass* to 
> whatever-baseclass*, where the TClass* allows to identify and access 
> objects deriving from whatever-baseclass.
> 
> Now, the suggestion I have is to make TClass store only the class name, 
> and when reading back, to let TClass's streamer search for the TClass 
> already instantiated which belongs to this class name. I believe this 
> would be the naive expectation of what a persistent TClass* does.
> 
> The questions I have are:
> * What do you (users and rootdev) think about that? Does it interfere 
> with what other people do with a persistent TClass?
> * Reading a member of type TClass*, is there any way ROOT can set this 
> pointer to the TClass object already instatiated or will we end up with 
> two instatiations for the same class?
> 
> Cheers, Axel.
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:02 MET