[ROOT] Saving a object in a ROOT file with a NULL pointer

From: Pierre-Luc Drouin (pldrouin@physics.carleton.ca)
Date: Fri Jun 06 2003 - 17:03:09 MEST


Hi,

I've a class that contains a member variable that is a pointer to another
object. This pointer can be NULL, if there's no need for a hold
object. The code of my class takes it into account, with
if(myptr!=NULL) conditions when operations on myptr have to be
done. However, I've noticed that ROOT craches when I try to save this
object into a ROOT file. I could use a Int_t variable 'hasptr' that would
have a value of 0 when there's no object hold by myptr and a value of 1
when there's one and I could indicate a size of '// [hasptr]' for ROOT in
the header file, but this would take useless memory...

Is there a Streamer or similar ROOT function I could overload for this
class in a way that it could handle a NULL pointer without crashing
ROOT?

Thank you!

Pierre-Luc Drouin



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET