-
Notifications
You must be signed in to change notification settings - Fork 0
/
CmdOptionSwitchOnPath.go
230 lines (204 loc) · 6.87 KB
/
CmdOptionSwitchOnPath.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package fbtypes
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type CmdOptionSwitchOnPathT struct {
PermType string `json:"permType"`
Mode SwitchOnPathMode `json:"mode"`
SignalId uint32 `json:"signalId"`
Action SwitchOnPathAction `json:"action"`
TargetPosition []float64 `json:"targetPosition"`
Radius float64 `json:"radius"`
PreTriggerTime float64 `json:"preTriggerTime"`
}
func (t *CmdOptionSwitchOnPathT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
if t == nil { return 0 }
permTypeOffset := flatbuffers.UOffsetT(0)
if t.PermType != "" {
permTypeOffset = builder.CreateString(t.PermType)
}
targetPositionOffset := flatbuffers.UOffsetT(0)
if t.TargetPosition != nil {
targetPositionLength := len(t.TargetPosition)
CmdOptionSwitchOnPathStartTargetPositionVector(builder, targetPositionLength)
for j := targetPositionLength - 1; j >= 0; j-- {
builder.PrependFloat64(t.TargetPosition[j])
}
targetPositionOffset = builder.EndVector(targetPositionLength)
}
CmdOptionSwitchOnPathStart(builder)
CmdOptionSwitchOnPathAddPermType(builder, permTypeOffset)
CmdOptionSwitchOnPathAddMode(builder, t.Mode)
CmdOptionSwitchOnPathAddSignalId(builder, t.SignalId)
CmdOptionSwitchOnPathAddAction(builder, t.Action)
CmdOptionSwitchOnPathAddTargetPosition(builder, targetPositionOffset)
CmdOptionSwitchOnPathAddRadius(builder, t.Radius)
CmdOptionSwitchOnPathAddPreTriggerTime(builder, t.PreTriggerTime)
return CmdOptionSwitchOnPathEnd(builder)
}
func (rcv *CmdOptionSwitchOnPath) UnPackTo(t *CmdOptionSwitchOnPathT) {
t.PermType = string(rcv.PermType())
t.Mode = rcv.Mode()
t.SignalId = rcv.SignalId()
t.Action = rcv.Action()
targetPositionLength := rcv.TargetPositionLength()
t.TargetPosition = make([]float64, targetPositionLength)
for j := 0; j < targetPositionLength; j++ {
t.TargetPosition[j] = rcv.TargetPosition(j)
}
t.Radius = rcv.Radius()
t.PreTriggerTime = rcv.PreTriggerTime()
}
func (rcv *CmdOptionSwitchOnPath) UnPack() *CmdOptionSwitchOnPathT {
if rcv == nil { return nil }
t := &CmdOptionSwitchOnPathT{}
rcv.UnPackTo(t)
return t
}
type CmdOptionSwitchOnPath struct {
_tab flatbuffers.Table
}
func GetRootAsCmdOptionSwitchOnPath(buf []byte, offset flatbuffers.UOffsetT) *CmdOptionSwitchOnPath {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &CmdOptionSwitchOnPath{}
x.Init(buf, n+offset)
return x
}
func GetSizePrefixedRootAsCmdOptionSwitchOnPath(buf []byte, offset flatbuffers.UOffsetT) *CmdOptionSwitchOnPath {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &CmdOptionSwitchOnPath{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func (rcv *CmdOptionSwitchOnPath) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *CmdOptionSwitchOnPath) Table() flatbuffers.Table {
return rcv._tab
}
/// permanent type (e.g. "Once", "PermOn", "PermOff")
func (rcv *CmdOptionSwitchOnPath) PermType() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
/// permanent type (e.g. "Once", "PermOn", "PermOff")
/// switch on path mode
func (rcv *CmdOptionSwitchOnPath) Mode() SwitchOnPathMode {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return SwitchOnPathMode(rcv._tab.GetInt8(o + rcv._tab.Pos))
}
return 0
}
/// switch on path mode
func (rcv *CmdOptionSwitchOnPath) MutateMode(n SwitchOnPathMode) bool {
return rcv._tab.MutateInt8Slot(6, int8(n))
}
/// signal id
func (rcv *CmdOptionSwitchOnPath) SignalId() uint32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return rcv._tab.GetUint32(o + rcv._tab.Pos)
}
return 0
}
/// signal id
func (rcv *CmdOptionSwitchOnPath) MutateSignalId(n uint32) bool {
return rcv._tab.MutateUint32Slot(8, n)
}
/// switch on path action
func (rcv *CmdOptionSwitchOnPath) Action() SwitchOnPathAction {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return SwitchOnPathAction(rcv._tab.GetInt8(o + rcv._tab.Pos))
}
return 0
}
/// switch on path action
func (rcv *CmdOptionSwitchOnPath) MutateAction(n SwitchOnPathAction) bool {
return rcv._tab.MutateInt8Slot(10, int8(n))
}
/// target position
func (rcv *CmdOptionSwitchOnPath) TargetPosition(j int) float64 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.GetFloat64(a + flatbuffers.UOffsetT(j*8))
}
return 0
}
func (rcv *CmdOptionSwitchOnPath) TargetPositionLength() int {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
return rcv._tab.VectorLen(o)
}
return 0
}
/// target position
func (rcv *CmdOptionSwitchOnPath) MutateTargetPosition(j int, n float64) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.MutateFloat64(a+flatbuffers.UOffsetT(j*8), n)
}
return false
}
/// radius
func (rcv *CmdOptionSwitchOnPath) Radius() float64 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
return rcv._tab.GetFloat64(o + rcv._tab.Pos)
}
return 0.0
}
/// radius
func (rcv *CmdOptionSwitchOnPath) MutateRadius(n float64) bool {
return rcv._tab.MutateFloat64Slot(14, n)
}
/// pre trigger time
func (rcv *CmdOptionSwitchOnPath) PreTriggerTime() float64 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
if o != 0 {
return rcv._tab.GetFloat64(o + rcv._tab.Pos)
}
return 0.0
}
/// pre trigger time
func (rcv *CmdOptionSwitchOnPath) MutatePreTriggerTime(n float64) bool {
return rcv._tab.MutateFloat64Slot(16, n)
}
func CmdOptionSwitchOnPathStart(builder *flatbuffers.Builder) {
builder.StartObject(7)
}
func CmdOptionSwitchOnPathAddPermType(builder *flatbuffers.Builder, permType flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(permType), 0)
}
func CmdOptionSwitchOnPathAddMode(builder *flatbuffers.Builder, mode SwitchOnPathMode) {
builder.PrependInt8Slot(1, int8(mode), 0)
}
func CmdOptionSwitchOnPathAddSignalId(builder *flatbuffers.Builder, signalId uint32) {
builder.PrependUint32Slot(2, signalId, 0)
}
func CmdOptionSwitchOnPathAddAction(builder *flatbuffers.Builder, action SwitchOnPathAction) {
builder.PrependInt8Slot(3, int8(action), 0)
}
func CmdOptionSwitchOnPathAddTargetPosition(builder *flatbuffers.Builder, targetPosition flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(4, flatbuffers.UOffsetT(targetPosition), 0)
}
func CmdOptionSwitchOnPathStartTargetPositionVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(8, numElems, 8)
}
func CmdOptionSwitchOnPathAddRadius(builder *flatbuffers.Builder, radius float64) {
builder.PrependFloat64Slot(5, radius, 0.0)
}
func CmdOptionSwitchOnPathAddPreTriggerTime(builder *flatbuffers.Builder, preTriggerTime float64) {
builder.PrependFloat64Slot(6, preTriggerTime, 0.0)
}
func CmdOptionSwitchOnPathEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}