• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# automatically generated by the FlatBuffers compiler, do not modify
2
3# namespace: NamespaceB
4
5import flatbuffers
6from flatbuffers.compat import import_numpy
7np = import_numpy()
8
9class StructInNestedNS(object):
10    __slots__ = ['_tab']
11
12    @classmethod
13    def SizeOf(cls):
14        return 8
15
16    # StructInNestedNS
17    def Init(self, buf, pos):
18        self._tab = flatbuffers.table.Table(buf, pos)
19
20    # StructInNestedNS
21    def A(self): return self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0))
22    # StructInNestedNS
23    def B(self): return self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(4))
24
25def CreateStructInNestedNS(builder, a, b):
26    builder.Prep(4, 8)
27    builder.PrependInt32(b)
28    builder.PrependInt32(a)
29    return builder.Offset()
30
31
32class StructInNestedNST(object):
33
34    # StructInNestedNST
35    def __init__(self):
36        self.a = 0  # type: int
37        self.b = 0  # type: int
38
39    @classmethod
40    def InitFromBuf(cls, buf, pos):
41        structInNestedNS = StructInNestedNS()
42        structInNestedNS.Init(buf, pos)
43        return cls.InitFromObj(structInNestedNS)
44
45    @classmethod
46    def InitFromObj(cls, structInNestedNS):
47        x = StructInNestedNST()
48        x._UnPack(structInNestedNS)
49        return x
50
51    # StructInNestedNST
52    def _UnPack(self, structInNestedNS):
53        if structInNestedNS is None:
54            return
55        self.a = structInNestedNS.A()
56        self.b = structInNestedNS.B()
57
58    # StructInNestedNST
59    def Pack(self, builder):
60        return CreateStructInNestedNS(builder, self.a, self.b)
61