# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Packets

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

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

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

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

    # HelloParam
    def Version(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

def HelloParamStart(builder): builder.StartObject(1)
def Start(builder):
    return HelloParamStart(builder)
def HelloParamAddVersion(builder, version): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(version), 0)
def AddVersion(builder, version):
    return HelloParamAddVersion(builder, version)
def HelloParamEnd(builder): return builder.EndObject()
def End(builder):
    return HelloParamEnd(builder)

class HelloParamT(object):

    # HelloParamT
    def __init__(self):
        self.version = None  # type: str

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

    @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, helloParam):
        x = HelloParamT()
        x._UnPack(helloParam)
        return x

    # HelloParamT
    def _UnPack(self, helloParam):
        if helloParam is None:
            return
        self.version = helloParam.Version()

    # HelloParamT
    def Pack(self, builder):
        if self.version is not None:
            version = builder.CreateString(self.version)
        HelloParamStart(builder)
        if self.version is not None:
            HelloParamAddVersion(builder, version)
        helloParam = HelloParamEnd(builder)
        return helloParam
