No streamer info saved for TMaps?

hi there,

I was trying to unmarshal types containing a TMap with groot but failed.
it seems ROOT files containing such values do not store the StreamerInfo for TMaps.


$> root
  | Welcome to ROOT 6.14/04       |
  |                               (c) 1995-2018, The ROOT Team |
  | Built for linuxx8664gcc                                    |
  | From tags/v6-14-04@v6-14-04, Aug 23 2018, 17:00:44         |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |

root [0] auto f = TFile::Open("o.root","RECREATE");
root [1] auto m = new TMap();
root [2] m->Add(new TObjString("key"), new TObjString("val"));
root [3] m->Write("my-map")
(int) 178
root [4] f->Write()
(int) 0
root [5] f->Close()
root [6] .q

$> root-ls -sinfos ./o.root 
=== [./o.root] ===
version: 61404
 StreamerInfo for "TObjString" version=1 title=""
  BASE    TObject offset=  0 type= 66 size=  0  Basic ROOT object
  TString fString offset=  0 type= 65 size= 24  wrapped TString
TObjString my-map  Collectable string class (cycle=2)
TObjString my-map  Collectable string class (cycle=1)

why is that?
other containers such as TList, THashList and TObjArray do get their TStreamerInfo stored inside the ROOT file…


ROOT Version: 6.14/04
Platform: Linux/amd64
Compiler: Not Provided

Indeed, TMap::Streamer was never updated to store the (relatively uninformative) StreamerInfo for it …
The streaming is hand coded (see TMap::Streamer) has:

      R__c = b.WriteVersion(TMap::IsA(), kTRUE);
      b << GetSize();
      TIter next(fTable);
      TPair *a;
      while ((a = (TPair*) next())) {
         b << a->Key();
         b << a->Value();
      b.SetByteCount(R__c, kTRUE);

ok. bummer :slight_smile: (I was relying on classes instances being written to a TFile to fetch TStreamerInfos and bootstrap groot with these C++ informations… I guess I’ll special-case TMap then.)

thanks a lot.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.