go-hep.org/x/hep@v0.38.1/groot/rbase/vpad.go (about)

     1  // Copyright ©2023 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 rbase
     6  
     7  import (
     8  	"reflect"
     9  
    10  	"go-hep.org/x/hep/groot/rbytes"
    11  	"go-hep.org/x/hep/groot/root"
    12  	"go-hep.org/x/hep/groot/rtypes"
    13  	"go-hep.org/x/hep/groot/rvers"
    14  )
    15  
    16  type VirtualPad struct {
    17  	obj     Object
    18  	attline AttLine
    19  	attfill AttFill
    20  	attpad  AttPad
    21  	qobj    QObject
    22  }
    23  
    24  func (*VirtualPad) Class() string {
    25  	return "TVirtualPad"
    26  }
    27  
    28  func (*VirtualPad) RVersion() int16 {
    29  	return rvers.VirtualPad
    30  }
    31  
    32  func (vpad *VirtualPad) UnmarshalROOT(r *rbytes.RBuffer) error {
    33  	if r.Err() != nil {
    34  		return r.Err()
    35  	}
    36  
    37  	hdr := r.ReadHeader(vpad.Class(), vpad.RVersion())
    38  
    39  	r.ReadObject(&vpad.obj)
    40  	r.ReadObject(&vpad.attline)
    41  	r.ReadObject(&vpad.attfill)
    42  	r.ReadObject(&vpad.attpad)
    43  	if hdr.Vers > 1 {
    44  		r.ReadObject(&vpad.qobj)
    45  	}
    46  
    47  	r.CheckHeader(hdr)
    48  	return r.Err()
    49  }
    50  
    51  func init() {
    52  	f := func() reflect.Value {
    53  		var v VirtualPad
    54  		return reflect.ValueOf(&v)
    55  	}
    56  	rtypes.Factory.Add("TVirtualPad", f)
    57  }
    58  
    59  var (
    60  	_ root.Object        = (*VirtualPad)(nil)
    61  	_ rbytes.Unmarshaler = (*VirtualPad)(nil)
    62  )