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 # Stat 18 def Init(self, buf, pos): 19 self._tab = flatbuffers.table.Table(buf, pos) 20 21 # Stat 22 def Id(self): 23 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 24 if o != 0: 25 return self._tab.String(o + self._tab.Pos) 26 return "" 27 28 # Stat 29 def Val(self): 30 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) 31 if o != 0: 32 return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) 33 return 0 34 35 # Stat 36 def Count(self): 37 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) 38 if o != 0: 39 return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos) 40 return 0 41 42 def StatStart(builder): builder.StartObject(3) 43 def StatAddId(builder, id): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) 44 def StatAddVal(builder, val): builder.PrependInt64Slot(1, val, 0) 45 def StatAddCount(builder, count): builder.PrependUint16Slot(2, count, 0) 46 def StatEnd(builder): return builder.EndObject() 47