/
base_leaf.go
66 lines (53 loc) · 1.37 KB
/
base_leaf.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
package groot
type ibaseLeaf interface {
toBaseLeaf() *baseLeaf
}
type baseLeaf struct {
name string
title string
ndata uint32 // number of elements in fAddress
length uint32 // number of fixed length elements
leaf_count *baseLeaf // pointer to Leaf-count if variable length
}
func (base *baseLeaf) Class() Class {
panic("not implemented")
}
func (base *baseLeaf) Name() string {
return base.name
}
func (base *baseLeaf) Title() string {
return base.title
}
func (base *baseLeaf) ROOTDecode(b *Buffer) (err error) {
spos := b.Pos()
vers, pos, bcnt := b.read_version()
printf("baseleaf-vers=%v pos=%v bcnt=%v\n", vers, pos, bcnt)
base.name, base.title = b.read_tnamed()
printf("baseleaf-name='%v' title='%v'\n", base.name, base.title)
base.length = b.ntou4()
printf("baseleaf-length=%v\n", base.length)
b.ntoi4() // fLengthType
b.ntoi4() // fOffset
b.ntobyte() // fIsRange
b.ntobyte() // fIsUnsigned
obj := b.read_object()
printf("baseleaf-nobjs: %v\n", obj)
if obj != nil {
base.leaf_count = obj.(ibaseLeaf).toBaseLeaf()
}
if base.length == 0 {
//FIXME: ??? really ??? (check with Guy)
base.length = 1
}
b.check_byte_count(pos, bcnt, spos, "TLeaf")
return
}
// func init() {
// f := func() reflect.Value {
// o := &BaseLeaf{}
// return reflect.ValueOf(o)
// }
// Factory.db["TBaseLeaf"] = f
// Factory.db["*groot.BaseLeaf"] = f
// }
// EOF