Using TTree Branch for a class that virtually inherits

Hi all.

I’d really like to use multiple virtual inheritance in my data structure classes. I have been trying to do the following:

class Base {

}

class Event : public virtual Base {

}

fillTree{
TTree *t = new Tree(…);
Event *e = new Event();
t->Branch(“eventBranch”, “Event”, &e, 32000, 99);

//loop and fill some Event members

t->Write();
}

My code compiles, but always breaks at the TTree::Branch. If I do not virtually inherit class Base, then it completely works fine.

Can anybody tell me what I’m doing wrong? Or is this a ROOT limitation?

The output from gdb that I get at this line is:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000028
0x00000001000036c9 in G__EventDict_146_0_26 ()

Thanks for your help.

Adam

ps - yes, I know that there is not any multiple inheritance at this point, but there would be if I could first get this to work.

Hi,

Virtual inheritance is currently not supported in ROOT I/O.

Cheers,
Philippe.

Salut Philippe,

[quote=“pcanal”]
Virtual inheritance is currently not supported in ROOT I/O.[/quote]

Are there any (concrete) plans to support this in the future? (If so, when?)

Thanks!

Charles

Hi Charles,

We are not planning on adding this support in the near term ; it requires some significant refactoring of the ‘meta’ package and we are not planning to do such refactoring until after we have significantly upgraded the dictionary generator and interpreter.

Cheers,
Philippe.

Hi Philippe,

Thanks for the quick reply. :smiley: Am I correct that the significant upgrade to the dictionary generator and interpreter is a timescale of a couple years (give or take)?

Thanks!

Charles

Yes :slight_smile:

Cheers,
Philippe.