blob: e0344e5fd0e7f386b98440bf114a50e00b6456d0 [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001# automatically generated by the FlatBuffers compiler, do not modify
2
3# namespace: Example
4
5import flatbuffers
Austin Schuh272c6132020-11-14 16:37:52 -08006from flatbuffers.compat import import_numpy
7np = import_numpy()
Austin Schuhe89fa2d2019-08-14 20:24:23 -07008
9class Ability(object):
10 __slots__ = ['_tab']
11
Austin Schuh272c6132020-11-14 16:37:52 -080012 @classmethod
13 def SizeOf(cls):
14 return 8
15
Austin Schuhe89fa2d2019-08-14 20:24:23 -070016 # Ability
17 def Init(self, buf, pos):
18 self._tab = flatbuffers.table.Table(buf, pos)
19
20 # Ability
21 def Id(self): return self._tab.Get(flatbuffers.number_types.Uint32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0))
22 # Ability
23 def Distance(self): return self._tab.Get(flatbuffers.number_types.Uint32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(4))
24
25def CreateAbility(builder, id, distance):
26 builder.Prep(4, 8)
27 builder.PrependUint32(distance)
28 builder.PrependUint32(id)
29 return builder.Offset()
Austin Schuh272c6132020-11-14 16:37:52 -080030
31
32class AbilityT(object):
33
34 # AbilityT
35 def __init__(self):
36 self.id = 0 # type: int
37 self.distance = 0 # type: int
38
39 @classmethod
40 def InitFromBuf(cls, buf, pos):
41 ability = Ability()
42 ability.Init(buf, pos)
43 return cls.InitFromObj(ability)
44
45 @classmethod
James Kuszmaul3b15b0c2022-11-08 14:03:16 -080046 def InitFromPackedBuf(cls, buf, pos=0):
47 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
48 return cls.InitFromBuf(buf, pos+n)
49
50 @classmethod
Austin Schuh272c6132020-11-14 16:37:52 -080051 def InitFromObj(cls, ability):
52 x = AbilityT()
53 x._UnPack(ability)
54 return x
55
56 # AbilityT
57 def _UnPack(self, ability):
58 if ability is None:
59 return
60 self.id = ability.Id()
61 self.distance = ability.Distance()
62
63 # AbilityT
64 def Pack(self, builder):
65 return CreateAbility(builder, self.id, self.distance)