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: Example |
| 4 | |
| 5 | import flatbuffers |
| 6 | |
| 7 | class Stat(object): |
| 8 | __slots__ = ['_tab'] |
| 9 | |
| 10 | @classmethod |
| 11 | def GetRootAsStat(cls, buf, offset): |
| 12 | n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) |
| 13 | x = Stat() |
| 14 | x.Init(buf, n + offset) |
| 15 | return x |
| 16 | |
| 17 | @classmethod |
| 18 | def StatBufferHasIdentifier(cls, buf, offset, size_prefixed=False): |
| 19 | return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed) |
| 20 | |
| 21 | # Stat |
| 22 | def Init(self, buf, pos): |
| 23 | self._tab = flatbuffers.table.Table(buf, pos) |
| 24 | |
| 25 | # Stat |
| 26 | def Id(self): |
| 27 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) |
| 28 | if o != 0: |
| 29 | return self._tab.String(o + self._tab.Pos) |
| 30 | return None |
| 31 | |
| 32 | # Stat |
| 33 | def Val(self): |
| 34 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) |
| 35 | if o != 0: |
| 36 | return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) |
| 37 | return 0 |
| 38 | |
| 39 | # Stat |
| 40 | def Count(self): |
| 41 | o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) |
| 42 | if o != 0: |
| 43 | return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos) |
| 44 | return 0 |
| 45 | |
| 46 | def StatStart(builder): builder.StartObject(3) |
| 47 | def StatAddId(builder, id): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) |
| 48 | def StatAddVal(builder, val): builder.PrependInt64Slot(1, val, 0) |
| 49 | def StatAddCount(builder, count): builder.PrependUint16Slot(2, count, 0) |
| 50 | def StatEnd(builder): return builder.EndObject() |