blob: edba9821522452ac5af1a2f26ca5110c937084cd [file] [log] [blame]
Austin Schuh2dd86a92022-09-14 21:19:23 -07001# automatically generated by the FlatBuffers compiler, do not modify
2
3# namespace: Example
4
5import flatbuffers
6from flatbuffers.compat import import_numpy
7np = import_numpy()
8
9class StructOfStructsOfStructs(object):
10 __slots__ = ['_tab']
11
12 @classmethod
13 def SizeOf(cls):
14 return 20
15
16 # StructOfStructsOfStructs
17 def Init(self, buf, pos):
18 self._tab = flatbuffers.table.Table(buf, pos)
19
20 # StructOfStructsOfStructs
21 def A(self, obj):
22 obj.Init(self._tab.Bytes, self._tab.Pos + 0)
23 return obj
24
25
26def CreateStructOfStructsOfStructs(builder, a_a_id, a_a_distance, a_b_a, a_b_b, a_c_id, a_c_distance):
27 builder.Prep(4, 20)
28 builder.Prep(4, 20)
29 builder.Prep(4, 8)
30 builder.PrependUint32(a_c_distance)
31 builder.PrependUint32(a_c_id)
32 builder.Prep(2, 4)
33 builder.Pad(1)
34 builder.PrependInt8(a_b_b)
35 builder.PrependInt16(a_b_a)
36 builder.Prep(4, 8)
37 builder.PrependUint32(a_a_distance)
38 builder.PrependUint32(a_a_id)
39 return builder.Offset()
40
41import MyGame.Example.StructOfStructs
42try:
43 from typing import Optional
44except:
45 pass
46
47class StructOfStructsOfStructsT(object):
48
49 # StructOfStructsOfStructsT
50 def __init__(self):
51 self.a = None # type: Optional[MyGame.Example.StructOfStructs.StructOfStructsT]
52
53 @classmethod
54 def InitFromBuf(cls, buf, pos):
55 structOfStructsOfStructs = StructOfStructsOfStructs()
56 structOfStructsOfStructs.Init(buf, pos)
57 return cls.InitFromObj(structOfStructsOfStructs)
58
59 @classmethod
60 def InitFromObj(cls, structOfStructsOfStructs):
61 x = StructOfStructsOfStructsT()
62 x._UnPack(structOfStructsOfStructs)
63 return x
64
65 # StructOfStructsOfStructsT
66 def _UnPack(self, structOfStructsOfStructs):
67 if structOfStructsOfStructs is None:
68 return
69 if structOfStructsOfStructs.A(MyGame.Example.StructOfStructs.StructOfStructs()) is not None:
70 self.a = MyGame.Example.StructOfStructs.StructOfStructsT.InitFromObj(structOfStructsOfStructs.A(MyGame.Example.StructOfStructs.StructOfStructs()))
71
72 # StructOfStructsOfStructsT
73 def Pack(self, builder):
74 return CreateStructOfStructsOfStructs(builder, self.a.a.id, self.a.a.distance, self.a.b.a, self.a.b.b, self.a.c.id, self.a.c.distance)