Re: [ROOT] Constructing an object with TClass() information

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Nov 23 2001 - 10:12:20 MET


Hi Volker,

No, the standard constructor is always called.
However, you can define a custom Streamer and in the read section add
all the re-initialisation or post-initialisation statements.
Example:
void Myclass::Streamer(TBuffer &R__b)
{
   if (R__b.IsReading()) {
      //put here your pre-initialisation statements
      Myclass::Class()->ReadBuffer(R__b, this);
      //put here your post-initialisation statements
   } else {
      Myclass::Class()->WriteBuffer(R__b,this);
   }
}


Rene Brun


Volker Hejny wrote:
> 
> Hallo,
> 
> if I have a class name as a string value at run time, it is possible
> to construct a new object of this class using TClass::New(). That
> way the standard constructor is called. Is there any way to call
> a different constructor with a given argument?
> 
> Best regards,
> Volker
> 
> --
> Dr. Volker Hejny                Tel: 02461/616853                      **
> Institut f. Kernphysik          Fax: 02461/613930                     **
> ---------------------------------------------------------------- **  ** ---
> Forschungszentrum Juelich GmbH, D-52425 Juelich                    **



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