Re: [ROOT] Streamer options

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Mar 30 2001 - 15:30:15 MEST


Hi Peter,

With version 3.00/6 this is possible (see below), but not recommended.
The data structure for the automatic Streamers is computed from
the current status of the data member definition.
The normal way (static way) to discard a data member from the I/O process
is to add a "!" character as the first character in the comment field.
Instead of this character, you can use the following dynamic way:
Assuming a class MyClass and a data member fMaybe,do:
   const Int_t kObjIsPersistent = 4;
   MyClass::Class()->GetDataMember("fMaybe")->SetBit(kObjIsPersistent,0);
Following this call, you can check that the member "fMaybe" is not in
the StreamerInfo with:
   MyClass::Class()->GetStreamerInfo()->ls();

or vice-versa, in case you had specified the "!" in the comment field,
you can force this member to be persistent by:
  MyClass::Class()->GetDataMember("fMaybe")->SetBit(kObjIsPersistent,1);

This technique will work if you want to set the option once for the duration
of the job. It would also be possible to do/undo/do/.. in the same job.
This will require a few more lines of code to delete the current StreamerInfo
, set the bit and recompute the StreamerInfo.

Rene Brun

Peter H. L. Christiansen wrote:
> 
> Hi ROOT users
> 
> I have a class where I sometimes wants to write down some elements and
> sometimes not. Is there a smart way of introducing a debug switch or do
> you have to write the streamer yourself ?
> 
> If I split the class in 2, like hit(always write) and hitdetails(inherits
> from hit) (sometimes write) can I then do something smart ?
> 
> Cheers
>    Peter



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