RE: Multiple inheritance and I/O

From: Clark McGrew <clark.mcgrew_at_sunysb.edu>
Date: Thu, 24 Jan 2008 18:56:04 -0500


Hi Philippe,

Thanks for the quick reply.

I'd already arrived at the solution you suggest, and it works great (but, it generates warnings about missing ShowMembers methods for the mix-ins).

My two specific questions are:

Will this functionality continue to be supported (i.e. excluding the non-TObject mix-ins from I/O while allowing I/O for the mix-in+TObject derived class)? Since it generates a warning, I'm worried that it might be considered an abuse of the I/O system.

Is there any way to disable the "Cannot find any ShowMembers..." in TClass::BuildRealData(void*)? That means adding a new way tell the I/O system that ShowMembers is intentionally missing (I assume that you want to leave the warning).

Thanks,
Clark

BTW: Here's a (very) simplified example of what I'm doing. The MyClass objects will be saved, but the NoIOClass portions should not be written.

class NoIOClass {
  // Don't ever save.
}

class MyClass : public TObject, public NoIOClass {

   ...
   ClassDef(MyClass, 3); // My class needs IO }

with linkdef's

#pragma link C++ class MyClass+;
#pragma link C++ class NoIOClass-;

On Thu, 2008-01-24 at 16:16 -0600, Philippe Canal wrote:
> Hi Clark,
>
> You still need to generate the dictionary via rootcint.
> However to disable the I/O, just set the class version to 0:
>
> ClassDef(MyClass,0);
>
> (ClassDef is required for classes inheriting from TObject).
>
> For classes not inheriting from TObject, you can also use
> the syntax:
> #pragma link C++ class NonTObject-;
> (note the trailing minus sign).
>
> Cheers,
> Philippe.
>
> -----Original Message-----
> From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On
> Behalf Of Clark McGrew
> Sent: Thursday, January 24, 2008 12:19 PM
> To: RootTalk mailing list
> Subject: [ROOT] Multiple inheritance and I/O
>
> Hello All,
>
> I'm working with some classes that inherit from TObject, and inherit
> from several "mix-in" base classes. What is the proper way tell ROOT to
> ignore a base class (so it doesn't take part in I/O)? In fact, I've
> found that I get the right behavior by creating CINT definitions for the
> mix-in classes to exclude I/O. Looking at the ROOT source code, and
> verifying the output files shows that ROOT is correctly reading and
> writing the classes, but I get a warning from TClass::BuildRealData
> about the missing ShowMembers method (it is after all missing). Can the
> warning be disabled?
>
> Thanks,
> Clark

-- 
Clark McGrew, Assoc. Prof.
Dept. of Physics and Astronomy
State University of New York at Stony Brook
<clark.mcgrew_at_stonybrook.edu>
631-632-8299
Received on Fri Jan 25 2008 - 00:56:18 CET

This archive was generated by hypermail 2.2.0 : Fri Jan 25 2008 - 23:50:01 CET