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 # StructInNestedNS 13 def Init(self, buf, pos): 14 self._tab = flatbuffers.table.Table(buf, pos) 15 16 # StructInNestedNS 17 def A(self): return self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0)) 18 # StructInNestedNS 19 def B(self): return self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(4)) 20 21def CreateStructInNestedNS(builder, a, b): 22 builder.Prep(4, 8) 23 builder.PrependInt32(b) 24 builder.PrependInt32(a) 25 return builder.Offset() 26 27 28class StructInNestedNST(object): 29 30 # StructInNestedNST 31 def __init__(self): 32 self.a = 0 # type: int 33 self.b = 0 # type: int 34 35 @classmethod 36 def InitFromBuf(cls, buf, pos): 37 structInNestedNS = StructInNestedNS() 38 structInNestedNS.Init(buf, pos) 39 return cls.InitFromObj(structInNestedNS) 40 41 @classmethod 42 def InitFromObj(cls, structInNestedNS): 43 x = StructInNestedNST() 44 x._UnPack(structInNestedNS) 45 return x 46 47 # StructInNestedNST 48 def _UnPack(self, structInNestedNS): 49 if structInNestedNS is None: 50 return 51 self.a = structInNestedNS.A() 52 self.b = structInNestedNS.B() 53 54 # StructInNestedNST 55 def Pack(self, builder): 56 return CreateStructInNestedNS(builder, self.a, self.b) 57