-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
groot/{cmd/root-gen-type,rdict}: add support for generating RVec types
Signed-off-by: Sebastien Binet <binet@cern.ch>
- Loading branch information
Showing
3 changed files
with
185 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
// DO NOT EDIT; automatically generated by root-gen-type | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"reflect" | ||
|
||
"go-hep.org/x/hep/groot/rbase" | ||
"go-hep.org/x/hep/groot/rbytes" | ||
"go-hep.org/x/hep/groot/rdict" | ||
"go-hep.org/x/hep/groot/rmeta" | ||
"go-hep.org/x/hep/groot/root" | ||
"go-hep.org/x/hep/groot/rtypes" | ||
) | ||
|
||
type ROOT__VecOps__RVec_float_ struct { | ||
This []float32 `groot:"This"` // <Float_t> Used to call the proper TStreamerInfo case | ||
} | ||
|
||
func (*ROOT__VecOps__RVec_float_) Class() string { | ||
return "ROOT::VecOps::RVec<float>" | ||
} | ||
|
||
func (*ROOT__VecOps__RVec_float_) RVersion() int16 { | ||
return 6 | ||
} | ||
|
||
// MarshalROOT implements rbytes.Marshaler | ||
func (o *ROOT__VecOps__RVec_float_) MarshalROOT(w *rbytes.WBuffer) (int, error) { | ||
if w.Err() != nil { | ||
return 0, w.Err() | ||
} | ||
|
||
hdr := w.WriteHeader(o.Class(), o.RVersion()) | ||
|
||
w.WriteStdVectorF32(o.This) | ||
|
||
return w.SetHeader(hdr) | ||
} | ||
|
||
// UnmarshalROOT implements rbytes.Unmarshaler | ||
func (o *ROOT__VecOps__RVec_float_) UnmarshalROOT(r *rbytes.RBuffer) error { | ||
if r.Err() != nil { | ||
return r.Err() | ||
} | ||
|
||
hdr := r.ReadHeader(o.Class()) | ||
if hdr.Vers > o.RVersion() { | ||
panic(fmt.Errorf( | ||
"rbytes: invalid %s version=%d > %d", | ||
o.Class(), hdr.Vers, o.RVersion(), | ||
)) | ||
} | ||
|
||
r.ReadStdVectorF32(&o.This) | ||
|
||
r.CheckHeader(hdr) | ||
return r.Err() | ||
} | ||
|
||
func init() { | ||
f := func() reflect.Value { | ||
var o ROOT__VecOps__RVec_float_ | ||
return reflect.ValueOf(&o) | ||
} | ||
rtypes.Factory.Add("ROOT::VecOps::RVec<float>", f) | ||
} | ||
|
||
func init() { | ||
// Streamer for ROOT::VecOps::RVec<float>. | ||
rdict.StreamerInfos.Add(rdict.NewCxxStreamerInfo("ROOT::VecOps::RVec<float>", 6, 0x9d22612c, []rbytes.StreamerElement{ | ||
rdict.NewCxxStreamerSTL(rdict.Element{ | ||
Name: *rbase.NewNamed("This", "<Float_t> Used to call the proper TStreamerInfo case"), | ||
Type: rmeta.Streamer, | ||
Size: 0, | ||
ArrLen: 0, | ||
ArrDim: 0, | ||
MaxIdx: [5]int32{0, 0, 0, 0, 0}, | ||
Offset: 0, | ||
EName: "ROOT::VecOps::RVec<float>", | ||
XMin: 0.000000, | ||
XMax: 0.000000, | ||
Factor: 0.000000, | ||
}.New(), 14, 5), | ||
})) | ||
} | ||
|
||
var ( | ||
_ root.Object = (*ROOT__VecOps__RVec_float_)(nil) | ||
_ rbytes.RVersioner = (*ROOT__VecOps__RVec_float_)(nil) | ||
_ rbytes.Marshaler = (*ROOT__VecOps__RVec_float_)(nil) | ||
_ rbytes.Unmarshaler = (*ROOT__VecOps__RVec_float_)(nil) | ||
) | ||
|
||
type ROOT__VecOps__RVec_int_ struct { | ||
This []int32 `groot:"This"` // <Int_t> Used to call the proper TStreamerInfo case | ||
} | ||
|
||
func (*ROOT__VecOps__RVec_int_) Class() string { | ||
return "ROOT::VecOps::RVec<int>" | ||
} | ||
|
||
func (*ROOT__VecOps__RVec_int_) RVersion() int16 { | ||
return 6 | ||
} | ||
|
||
// MarshalROOT implements rbytes.Marshaler | ||
func (o *ROOT__VecOps__RVec_int_) MarshalROOT(w *rbytes.WBuffer) (int, error) { | ||
if w.Err() != nil { | ||
return 0, w.Err() | ||
} | ||
|
||
hdr := w.WriteHeader(o.Class(), o.RVersion()) | ||
|
||
w.WriteStdVectorI32(o.This) | ||
|
||
return w.SetHeader(hdr) | ||
} | ||
|
||
// UnmarshalROOT implements rbytes.Unmarshaler | ||
func (o *ROOT__VecOps__RVec_int_) UnmarshalROOT(r *rbytes.RBuffer) error { | ||
if r.Err() != nil { | ||
return r.Err() | ||
} | ||
|
||
hdr := r.ReadHeader(o.Class()) | ||
if hdr.Vers > o.RVersion() { | ||
panic(fmt.Errorf( | ||
"rbytes: invalid %s version=%d > %d", | ||
o.Class(), hdr.Vers, o.RVersion(), | ||
)) | ||
} | ||
|
||
r.ReadStdVectorI32(&o.This) | ||
|
||
r.CheckHeader(hdr) | ||
return r.Err() | ||
} | ||
|
||
func init() { | ||
f := func() reflect.Value { | ||
var o ROOT__VecOps__RVec_int_ | ||
return reflect.ValueOf(&o) | ||
} | ||
rtypes.Factory.Add("ROOT::VecOps::RVec<int>", f) | ||
} | ||
|
||
func init() { | ||
// Streamer for ROOT::VecOps::RVec<int>. | ||
rdict.StreamerInfos.Add(rdict.NewCxxStreamerInfo("ROOT::VecOps::RVec<int>", 6, 0xbc2043d1, []rbytes.StreamerElement{ | ||
rdict.NewCxxStreamerSTL(rdict.Element{ | ||
Name: *rbase.NewNamed("This", "<Int_t> Used to call the proper TStreamerInfo case"), | ||
Type: rmeta.Streamer, | ||
Size: 0, | ||
ArrLen: 0, | ||
ArrDim: 0, | ||
MaxIdx: [5]int32{0, 0, 0, 0, 0}, | ||
Offset: 0, | ||
EName: "ROOT::VecOps::RVec<int>", | ||
XMin: 0.000000, | ||
XMax: 0.000000, | ||
Factor: 0.000000, | ||
}.New(), 14, 3), | ||
})) | ||
} | ||
|
||
var ( | ||
_ root.Object = (*ROOT__VecOps__RVec_int_)(nil) | ||
_ rbytes.RVersioner = (*ROOT__VecOps__RVec_int_)(nil) | ||
_ rbytes.Marshaler = (*ROOT__VecOps__RVec_int_)(nil) | ||
_ rbytes.Unmarshaler = (*ROOT__VecOps__RVec_int_)(nil) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters