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