-
Notifications
You must be signed in to change notification settings - Fork 0
/
StateSwitchingInfo.go
121 lines (103 loc) · 3.46 KB
/
StateSwitchingInfo.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
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package fbs2
import (
flatbuffers "github.com/google/flatbuffers/go"
)
/// Switching progress (initial / current / target) of Scheduler operation state
type StateSwitchingInfoT struct {
Initial CurrentState `json:"initial"`
Current CurrentState `json:"current"`
Target CurrentState `json:"target"`
}
func (t *StateSwitchingInfoT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
if t == nil { return 0 }
StateSwitchingInfoStart(builder)
StateSwitchingInfoAddInitial(builder, t.Initial)
StateSwitchingInfoAddCurrent(builder, t.Current)
StateSwitchingInfoAddTarget(builder, t.Target)
return StateSwitchingInfoEnd(builder)
}
func (rcv *StateSwitchingInfo) UnPackTo(t *StateSwitchingInfoT) {
t.Initial = rcv.Initial()
t.Current = rcv.Current()
t.Target = rcv.Target()
}
func (rcv *StateSwitchingInfo) UnPack() *StateSwitchingInfoT {
if rcv == nil { return nil }
t := &StateSwitchingInfoT{}
rcv.UnPackTo(t)
return t
}
type StateSwitchingInfo struct {
_tab flatbuffers.Table
}
func GetRootAsStateSwitchingInfo(buf []byte, offset flatbuffers.UOffsetT) *StateSwitchingInfo {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &StateSwitchingInfo{}
x.Init(buf, n+offset)
return x
}
func GetSizePrefixedRootAsStateSwitchingInfo(buf []byte, offset flatbuffers.UOffsetT) *StateSwitchingInfo {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &StateSwitchingInfo{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func (rcv *StateSwitchingInfo) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *StateSwitchingInfo) Table() flatbuffers.Table {
return rcv._tab
}
/// Initial operation state of Scheduler at the beginning of switching
func (rcv *StateSwitchingInfo) Initial() CurrentState {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return CurrentState(rcv._tab.GetInt8(o + rcv._tab.Pos))
}
return 2
}
/// Initial operation state of Scheduler at the beginning of switching
func (rcv *StateSwitchingInfo) MutateInitial(n CurrentState) bool {
return rcv._tab.MutateInt8Slot(4, int8(n))
}
/// Current operation state of Scheduler
func (rcv *StateSwitchingInfo) Current() CurrentState {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return CurrentState(rcv._tab.GetInt8(o + rcv._tab.Pos))
}
return 2
}
/// Current operation state of Scheduler
func (rcv *StateSwitchingInfo) MutateCurrent(n CurrentState) bool {
return rcv._tab.MutateInt8Slot(6, int8(n))
}
/// Target operation state of Scheduler
func (rcv *StateSwitchingInfo) Target() CurrentState {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return CurrentState(rcv._tab.GetInt8(o + rcv._tab.Pos))
}
return 2
}
/// Target operation state of Scheduler
func (rcv *StateSwitchingInfo) MutateTarget(n CurrentState) bool {
return rcv._tab.MutateInt8Slot(8, int8(n))
}
func StateSwitchingInfoStart(builder *flatbuffers.Builder) {
builder.StartObject(3)
}
func StateSwitchingInfoAddInitial(builder *flatbuffers.Builder, initial CurrentState) {
builder.PrependInt8Slot(0, int8(initial), 2)
}
func StateSwitchingInfoAddCurrent(builder *flatbuffers.Builder, current CurrentState) {
builder.PrependInt8Slot(1, int8(current), 2)
}
func StateSwitchingInfoAddTarget(builder *flatbuffers.Builder, target CurrentState) {
builder.PrependInt8Slot(2, int8(target), 2)
}
func StateSwitchingInfoEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}