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: NamespaceB |
| 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 TableInNestedNS(object): |
| 10 | __slots__ = ['_tab'] |
| 11 | |
| 12 | @classmethod |
| 13 | def GetRootAsTableInNestedNS(cls, buf, offset): |
| 14 | n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) |
| 15 | x = TableInNestedNS() |
| 16 | x.Init(buf, n + offset) |
| 17 | return x |
| 18 | |
| 19 | # TableInNestedNS |
| 20 | def Init(self, buf, pos): |
| 21 | self._tab = flatbuffers.table.Table(buf, pos) |
| 22 | |
| 23 | # TableInNestedNS |
| 24 | def Foo(self): |
| 25 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) |
| 26 | if o != 0: |
| 27 | return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) |
| 28 | return 0 |
| 29 | |
| 30 | def TableInNestedNSStart(builder): builder.StartObject(1) |
| 31 | def TableInNestedNSAddFoo(builder, foo): builder.PrependInt32Slot(0, foo, 0) |
| 32 | def TableInNestedNSEnd(builder): return builder.EndObject() |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 33 | |
| 34 | |
| 35 | class TableInNestedNST(object): |
| 36 | |
| 37 | # TableInNestedNST |
| 38 | def __init__(self): |
| 39 | self.foo = 0 # type: int |
| 40 | |
| 41 | @classmethod |
| 42 | def InitFromBuf(cls, buf, pos): |
| 43 | tableInNestedNS = TableInNestedNS() |
| 44 | tableInNestedNS.Init(buf, pos) |
| 45 | return cls.InitFromObj(tableInNestedNS) |
| 46 | |
| 47 | @classmethod |
| 48 | def InitFromObj(cls, tableInNestedNS): |
| 49 | x = TableInNestedNST() |
| 50 | x._UnPack(tableInNestedNS) |
| 51 | return x |
| 52 | |
| 53 | # TableInNestedNST |
| 54 | def _UnPack(self, tableInNestedNS): |
| 55 | if tableInNestedNS is None: |
| 56 | return |
| 57 | self.foo = tableInNestedNS.Foo() |
| 58 | |
| 59 | # TableInNestedNST |
| 60 | def Pack(self, builder): |
| 61 | TableInNestedNSStart(builder) |
| 62 | TableInNestedNSAddFoo(builder, self.foo) |
| 63 | tableInNestedNS = TableInNestedNSEnd(builder) |
| 64 | return tableInNestedNS |