Patrik Gustavsson | 8f1f9aa | 2021-06-28 07:41:58 +0200 | [diff] [blame^] | 1 | # automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | # namespace: tosa |
| 4 | |
| 5 | import flatbuffers |
| 6 | |
| 7 | class TosaGraph(object): |
| 8 | __slots__ = ['_tab'] |
| 9 | |
| 10 | @classmethod |
| 11 | def GetRootAsTosaGraph(cls, buf, offset): |
| 12 | n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) |
| 13 | x = TosaGraph() |
| 14 | x.Init(buf, n + offset) |
| 15 | return x |
| 16 | |
| 17 | # TosaGraph |
| 18 | def Init(self, buf, pos): |
| 19 | self._tab = flatbuffers.table.Table(buf, pos) |
| 20 | |
| 21 | # TosaGraph |
| 22 | def Version(self): |
| 23 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) |
| 24 | if o != 0: |
| 25 | x = self._tab.Indirect(o + self._tab.Pos) |
| 26 | from .Version import Version |
| 27 | obj = Version() |
| 28 | obj.Init(self._tab.Bytes, x) |
| 29 | return obj |
| 30 | return None |
| 31 | |
| 32 | # TosaGraph |
| 33 | def Blocks(self, j): |
| 34 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) |
| 35 | if o != 0: |
| 36 | x = self._tab.Vector(o) |
| 37 | x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 |
| 38 | x = self._tab.Indirect(x) |
| 39 | from .TosaBasicBlock import TosaBasicBlock |
| 40 | obj = TosaBasicBlock() |
| 41 | obj.Init(self._tab.Bytes, x) |
| 42 | return obj |
| 43 | return None |
| 44 | |
| 45 | # TosaGraph |
| 46 | def BlocksLength(self): |
| 47 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) |
| 48 | if o != 0: |
| 49 | return self._tab.VectorLen(o) |
| 50 | return 0 |
| 51 | |
| 52 | def TosaGraphStart(builder): builder.StartObject(2) |
| 53 | def TosaGraphAddVersion(builder, version): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(version), 0) |
| 54 | def TosaGraphAddBlocks(builder, blocks): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(blocks), 0) |
| 55 | def TosaGraphStartBlocksVector(builder, numElems): return builder.StartVector(4, numElems, 4) |
| 56 | def TosaGraphEnd(builder): return builder.EndObject() |