1# automatically generated by the FlatBuffers compiler, do not modify 2 3# namespace: NamespaceA 4 5import flatbuffers 6from flatbuffers.compat import import_numpy 7np = import_numpy() 8 9class SecondTableInA(object): 10 __slots__ = ['_tab'] 11 12 @classmethod 13 def GetRootAs(cls, buf, offset=0): 14 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 15 x = SecondTableInA() 16 x.Init(buf, n + offset) 17 return x 18 19 @classmethod 20 def GetRootAsSecondTableInA(cls, buf, offset=0): 21 """This method is deprecated. Please switch to GetRootAs.""" 22 return cls.GetRootAs(buf, offset) 23 # SecondTableInA 24 def Init(self, buf, pos): 25 self._tab = flatbuffers.table.Table(buf, pos) 26 27 # SecondTableInA 28 def ReferToC(self): 29 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 30 if o != 0: 31 x = self._tab.Indirect(o + self._tab.Pos) 32 obj = TableInC() 33 obj.Init(self._tab.Bytes, x) 34 return obj 35 return None 36 37def Start(builder): builder.StartObject(1) 38def SecondTableInAStart(builder): 39 """This method is deprecated. Please switch to Start.""" 40 return Start(builder) 41def AddReferToC(builder, referToC): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(referToC), 0) 42def SecondTableInAAddReferToC(builder, referToC): 43 """This method is deprecated. Please switch to AddReferToC.""" 44 return AddReferToC(builder, referToC) 45def End(builder): return builder.EndObject() 46def SecondTableInAEnd(builder): 47 """This method is deprecated. Please switch to End.""" 48 return End(builder) 49try: 50 from typing import Optional 51except: 52 pass 53 54class SecondTableInAT(object): 55 56 # SecondTableInAT 57 def __init__(self): 58 self.referToC = None # type: Optional[TableInCT] 59 60 @classmethod 61 def InitFromBuf(cls, buf, pos): 62 secondTableInA = SecondTableInA() 63 secondTableInA.Init(buf, pos) 64 return cls.InitFromObj(secondTableInA) 65 66 @classmethod 67 def InitFromObj(cls, secondTableInA): 68 x = SecondTableInAT() 69 x._UnPack(secondTableInA) 70 return x 71 72 # SecondTableInAT 73 def _UnPack(self, secondTableInA): 74 if secondTableInA is None: 75 return 76 if secondTableInA.ReferToC() is not None: 77 self.referToC = TableInCT.InitFromObj(secondTableInA.ReferToC()) 78 79 # SecondTableInAT 80 def Pack(self, builder): 81 if self.referToC is not None: 82 referToC = self.referToC.Pack(builder) 83 Start(builder) 84 if self.referToC is not None: 85 AddReferToC(builder, referToC) 86 secondTableInA = End(builder) 87 return secondTableInA 88