-
Notifications
You must be signed in to change notification settings - Fork 35
/
named.go
65 lines (52 loc) · 1.37 KB
/
named.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
// 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 rootio
import "reflect"
// The TNamed class is the base class for all named ROOT classes
// A TNamed contains the essential elements (name, title)
// to identify a derived object in containers, directories and files.
// Most member functions defined in this base class are in general
// overridden by the derived classes.
type tnamed struct {
obj tobject
name string
title string
}
// Name returns the name of the instance
func (n *tnamed) Name() string {
return n.name
}
// Title returns the title of the instance
func (n *tnamed) Title() string {
return n.title
}
func (n *tnamed) Class() string {
return "TNamed"
}
func (n *tnamed) UnmarshalROOT(r *RBuffer) error {
if r.err != nil {
return r.err
}
beg := r.Pos()
/*vers*/ _, pos, bcnt := r.ReadVersion()
if err := n.obj.UnmarshalROOT(r); err != nil {
r.err = err
return r.err
}
r.ReadString(&n.name)
r.ReadString(&n.title)
r.CheckByteCount(pos, bcnt, beg, "TNamed")
return r.Err()
}
func init() {
f := func() reflect.Value {
o := &tnamed{}
return reflect.ValueOf(o)
}
Factory.add("TNamed", f)
Factory.add("*rootio.tnamed", f)
}
var _ Object = (*tnamed)(nil)
var _ Named = (*tnamed)(nil)
var _ ROOTUnmarshaler = (*tnamed)(nil)