Re: Reading objects in TObjectBranch without new/delete?

From: Fons Rademakers (rdm@pcsalo.cern.ch)
Date: Thu Oct 28 1999 - 23:05:10 MEST


Hi Stefan,

  this is called a destructor which can be explicitely called like:

obj->~TObject();

Cheers, Fons.

> 
> I would have another suggestion for a convenience to users of objects,
> which don't get deleted. These must be "cleared" after every event, if
> they allocate memory or contain a pointer to a TClonesAyrray. Adding a new
> virtual member function to TObject might make this easier:
> 
> class TObject {
> 
> ...
> 
> public:
> 
> virtual Clear() {}
> 
> ...
> 
> }
> 
> A user could implement Clear() to do the cleaning up if neccessary and
> TBranch would call it always just before actually reading a new entry (if
> it is in the state that it does not delete/create objects for every
> entry, a default or from calling TTree::SetAutoDelete(false) or
> TBranch::SetAutoDelete(false)). 
> 
> cheers, Stefan
> 
> ---Stefan Kluth---------------Lynen Fellow----------------|\--|\-------
> -  LBNL, MS 50A 2160       -  phone:  +1 510 495 2376  -  |/  |/      -
> -  1 Cyclotron Rd.         -  fax:    +1 510 495 2957  -  |\/\|\/\|'  -
> ---Berkeley, CA94720, USA-----e-mail: SKluth@lbl.gov------|/\/|/\/|----
> 


-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:41 MET