# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Packets

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class QueryProfileResult(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = QueryProfileResult()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsQueryProfileResult(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # QueryProfileResult
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # QueryProfileResult
    def Fps(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
        return 0

def QueryProfileResultStart(builder): builder.StartObject(1)
def Start(builder):
    return QueryProfileResultStart(builder)
def QueryProfileResultAddFps(builder, fps): builder.PrependUint32Slot(0, fps, 0)
def AddFps(builder, fps):
    return QueryProfileResultAddFps(builder, fps)
def QueryProfileResultEnd(builder): return builder.EndObject()
def End(builder):
    return QueryProfileResultEnd(builder)

class QueryProfileResultT(object):

    # QueryProfileResultT
    def __init__(self):
        self.fps = 0  # type: int

    @classmethod
    def InitFromBuf(cls, buf, pos):
        queryProfileResult = QueryProfileResult()
        queryProfileResult.Init(buf, pos)
        return cls.InitFromObj(queryProfileResult)

    @classmethod
    def InitFromPackedBuf(cls, buf, pos=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
        return cls.InitFromBuf(buf, pos+n)

    @classmethod
    def InitFromObj(cls, queryProfileResult):
        x = QueryProfileResultT()
        x._UnPack(queryProfileResult)
        return x

    # QueryProfileResultT
    def _UnPack(self, queryProfileResult):
        if queryProfileResult is None:
            return
        self.fps = queryProfileResult.Fps()

    # QueryProfileResultT
    def Pack(self, builder):
        QueryProfileResultStart(builder)
        QueryProfileResultAddFps(builder, self.fps)
        queryProfileResult = QueryProfileResultEnd(builder)
        return queryProfileResult
