/
Int32Vector.go
101 lines (87 loc) · 2.44 KB
/
Int32Vector.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package tflite
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type Int32VectorT struct {
Values []int32
}
func (t *Int32VectorT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
if t == nil { return 0 }
valuesOffset := flatbuffers.UOffsetT(0)
if t.Values != nil {
valuesLength := len(t.Values)
Int32VectorStartValuesVector(builder, valuesLength)
for j := valuesLength - 1; j >= 0; j-- {
builder.PrependInt32(t.Values[j])
}
valuesOffset = builder.EndVector(valuesLength)
}
Int32VectorStart(builder)
Int32VectorAddValues(builder, valuesOffset)
return Int32VectorEnd(builder)
}
func (rcv *Int32Vector) UnPackTo(t *Int32VectorT) {
valuesLength := rcv.ValuesLength()
t.Values = make([]int32, valuesLength)
for j := 0; j < valuesLength; j++ {
t.Values[j] = rcv.Values(j)
}
}
func (rcv *Int32Vector) UnPack() *Int32VectorT {
if rcv == nil { return nil }
t := &Int32VectorT{}
rcv.UnPackTo(t)
return t
}
type Int32Vector struct {
_tab flatbuffers.Table
}
func GetRootAsInt32Vector(buf []byte, offset flatbuffers.UOffsetT) *Int32Vector {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &Int32Vector{}
x.Init(buf, n+offset)
return x
}
func (rcv *Int32Vector) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *Int32Vector) Table() flatbuffers.Table {
return rcv._tab
}
func (rcv *Int32Vector) Values(j int) int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetInt32(a + flatbuffers.UOffsetT(j*4))
}
return 0
}
func (rcv *Int32Vector) ValuesLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
func (rcv *Int32Vector) MutateValues(j int, n int32) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateInt32(a+flatbuffers.UOffsetT(j*4), n)
}
return false
}
func Int32VectorStart(builder *flatbuffers.Builder) {
builder.StartObject(1)
}
func Int32VectorAddValues(builder *flatbuffers.Builder, values flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(values), 0)
}
func Int32VectorStartValuesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func Int32VectorEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}