forked from alecthomas/go_serialization_benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FlatBufferA.go
116 lines (99 loc) · 2.83 KB
/
FlatBufferA.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// automatically generated by the FlatBuffers compiler, do not modify
package goserbench
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type FlatBufferA struct {
_tab flatbuffers.Table
}
func GetRootAsFlatBufferA(buf []byte, offset flatbuffers.UOffsetT) *FlatBufferA {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &FlatBufferA{}
x.Init(buf, n+offset)
return x
}
func (rcv *FlatBufferA) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *FlatBufferA) Table() flatbuffers.Table {
return rcv._tab
}
func (rcv *FlatBufferA) Name() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
func (rcv *FlatBufferA) BirthDay() int64 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return rcv._tab.GetInt64(o + rcv._tab.Pos)
}
return 0
}
func (rcv *FlatBufferA) MutateBirthDay(n int64) bool {
return rcv._tab.MutateInt64Slot(6, n)
}
func (rcv *FlatBufferA) Phone() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
func (rcv *FlatBufferA) Siblings() int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return rcv._tab.GetInt32(o + rcv._tab.Pos)
}
return 0
}
func (rcv *FlatBufferA) MutateSiblings(n int32) bool {
return rcv._tab.MutateInt32Slot(10, n)
}
func (rcv *FlatBufferA) Spouse() byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
return rcv._tab.GetByte(o + rcv._tab.Pos)
}
return 0
}
func (rcv *FlatBufferA) MutateSpouse(n byte) bool {
return rcv._tab.MutateByteSlot(12, n)
}
func (rcv *FlatBufferA) Money() float64 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
return rcv._tab.GetFloat64(o + rcv._tab.Pos)
}
return 0.0
}
func (rcv *FlatBufferA) MutateMoney(n float64) bool {
return rcv._tab.MutateFloat64Slot(14, n)
}
func FlatBufferAStart(builder *flatbuffers.Builder) {
builder.StartObject(6)
}
func FlatBufferAAddName(builder *flatbuffers.Builder, name flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(name), 0)
}
func FlatBufferAAddBirthDay(builder *flatbuffers.Builder, birthDay int64) {
builder.PrependInt64Slot(1, birthDay, 0)
}
func FlatBufferAAddPhone(builder *flatbuffers.Builder, phone flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(phone), 0)
}
func FlatBufferAAddSiblings(builder *flatbuffers.Builder, siblings int32) {
builder.PrependInt32Slot(3, siblings, 0)
}
func FlatBufferAAddSpouse(builder *flatbuffers.Builder, spouse byte) {
builder.PrependByteSlot(4, spouse, 0)
}
func FlatBufferAAddMoney(builder *flatbuffers.Builder, money float64) {
builder.PrependFloat64Slot(5, money, 0.0)
}
func FlatBufferAEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}