go-hep.org/x/hep@v0.38.1/groot/rdict/z_tstring_streamer.go (about) 1 // Copyright ©2022 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package rdict 6 7 import ( 8 "fmt" 9 10 "go-hep.org/x/hep/groot/rbase" 11 "go-hep.org/x/hep/groot/rmeta" 12 ) 13 14 func init() { 15 si, ok := StreamerInfos.Get("TString", -1) 16 if !ok { 17 panic(fmt.Errorf("rdict: could not get streamer info for TString")) 18 } 19 if len(si.Elements()) != 0 { 20 return 21 } 22 23 // FIXME(sbinet): the ROOT/C++ streamer for TString is a simple placeholder. 24 // but groot relies on the actual list of StreamerElements to generate the r/w-streaming code. 25 // So, apply this "regularization" and hope for the best. 26 sinfo := si.(*StreamerInfo) 27 sinfo.elems = append(sinfo.elems, &StreamerBasicType{ 28 StreamerElement: Element{ 29 Name: *rbase.NewNamed("This", "Used to call the proper TStreamerInfo case"), 30 Type: rmeta.TString, 31 Size: 25, 32 MaxIdx: [5]int32{0, 0, 0, 0, 0}, 33 EName: "TString", 34 }.New(), 35 }) 36 }