-
Notifications
You must be signed in to change notification settings - Fork 35
/
attfill.go
80 lines (64 loc) · 1.43 KB
/
attfill.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Copyright ©2017 The go-hep Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package rbase
import (
"reflect"
"go-hep.org/x/hep/groot/rbytes"
"go-hep.org/x/hep/groot/root"
"go-hep.org/x/hep/groot/rtypes"
"go-hep.org/x/hep/groot/rvers"
)
type AttFill struct {
Color int16
Style int16
}
func NewAttFill() *AttFill {
return &AttFill{
Color: 0,
Style: 1001, // FIXME(sbinet)
}
}
func (*AttFill) Class() string {
return "TAttFill"
}
func (*AttFill) RVersion() int16 {
return rvers.AttFill
}
func (a *AttFill) MarshalROOT(w *rbytes.WBuffer) (int, error) {
if w.Err() != nil {
return 0, w.Err()
}
hdr := w.WriteHeader(a.Class(), a.RVersion())
w.WriteI16(a.Color)
w.WriteI16(a.Style)
return w.SetHeader(hdr)
}
func (a *AttFill) UnmarshalROOT(r *rbytes.RBuffer) error {
if r.Err() != nil {
return r.Err()
}
hdr := r.ReadHeader(a.Class())
a.Color = r.ReadI16()
a.Style = r.ReadI16()
r.CheckHeader(hdr)
return r.Err()
}
func (a *AttFill) RMembers() []rbytes.Member {
return []rbytes.Member{
{Name: "fFillColor", Value: &a.Color},
{Name: "fFillStyle", Value: &a.Style},
}
}
func init() {
f := func() reflect.Value {
o := NewAttFill()
return reflect.ValueOf(o)
}
rtypes.Factory.Add("TAttFill", f)
}
var (
_ root.Object = (*AttFill)(nil)
_ rbytes.Marshaler = (*AttFill)(nil)
_ rbytes.Unmarshaler = (*AttFill)(nil)
)