Dear all,
I am (still) trying to store and retrieve StreamerInfos into a database along with the objects themselves. For the objects there are no problems, I use TMessage. I try to do the same for the StreamerInfos. The storage seems to work but the retrieval does not.
Storage
// Note "mo" is the object that I store in the database, it doesn't inherit from TObject but has dictionaries.
TMessage::EnableSchemaEvolutionForAll(true);
TMessage messinfo(kMESS_STREAMERINFO);
messinfo.WriteObjectAny(mo, mo->IsA());
TList *streamerInfos = messinfo.GetStreamerInfos();
if (streamerInfos && streamerInfos->GetEntries()) {
mess.Reset();
mess.WriteObjectAny(streamerInfos, streamerInfos->IsA());
fStatement->SetBinary(index+6, mess.Buffer(), mess.Length(), mess.Length());
}
In the database I see the blob stored, this seems to be working fine.
Loading
void* streamersBlob = 0;
Long_t streamersSize = 0;
// (...) fStatement->GetBinary(5, streamersBlob, streamersSize); (...)
TMessage::EnableSchemaEvolutionForAll(true);
TMessage messStreamers(kMESS_STREAMERINFO);
messStreamers.SetBuffer(streamersBlob, streamersSize, kFALSE);
messStreamers.SetReadMode();
messStreamers.Reset();
cout << "mess.GetClass() : " << messStreamers.GetClass() << endl;
TList *streamers = (TList*) messStreamers.ReadObjectAny(messStreamers.GetClass());
if(streamers) {
// ???
} else {
cout << "no streamer read" << endl;
}
The object “streamers” is null and I see that messStreamers.GetClass() returns null as well. For the object themselves there is no problem (I can paste the code if you need it although I do exactly the same).
I don’t understand why it can’t determinate the class here. Moreover, if I say “messStreamers.ReadObjectAny(TList::Class());” instead, it outputs
My questions
[list=]
[]Why messStreamers.GetClass() returns 0
[]Why ReadObjectAny(TList::Class()) outputs errors
[*]If I am finally able to get the list of streamers, what should I do with it in order to make ROOT aware of it ?
[/list]
Thank you very much for your kind help,
Barth