blob: e57dfd74f72c4fa69b72bec23544748fd3098185 [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
46 def InitFromObj(cls, ability):
47 x = AbilityT()
48 x._UnPack(ability)
49 return x
50
51 # AbilityT
52 def _UnPack(self, ability):
53 if ability is None:
54 return
55 self.id = ability.Id()
56 self.distance = ability.Distance()
57
58 # AbilityT
59 def Pack(self, builder):
60 return CreateAbility(builder, self.id, self.distance)