# automatically generated by the FlatBuffers compiler, do not modify

# namespace: Packets

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

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

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

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

    # DumpObjectsHierarchyParam
    def ObjectId(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

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

def DumpObjectsHierarchyParamStart(builder): builder.StartObject(2)
def Start(builder):
    return DumpObjectsHierarchyParamStart(builder)
def DumpObjectsHierarchyParamAddObjectId(builder, objectId): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(objectId), 0)
def AddObjectId(builder, objectId):
    return DumpObjectsHierarchyParamAddObjectId(builder, objectId)
def DumpObjectsHierarchyParamAddDepth(builder, depth): builder.PrependUint32Slot(1, depth, 0)
def AddDepth(builder, depth):
    return DumpObjectsHierarchyParamAddDepth(builder, depth)
def DumpObjectsHierarchyParamEnd(builder): return builder.EndObject()
def End(builder):
    return DumpObjectsHierarchyParamEnd(builder)

class DumpObjectsHierarchyParamT(object):

    # DumpObjectsHierarchyParamT
    def __init__(self):
        self.objectId = None  # type: str
        self.depth = 0  # type: int

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

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

    # DumpObjectsHierarchyParamT
    def _UnPack(self, dumpObjectsHierarchyParam):
        if dumpObjectsHierarchyParam is None:
            return
        self.objectId = dumpObjectsHierarchyParam.ObjectId()
        self.depth = dumpObjectsHierarchyParam.Depth()

    # DumpObjectsHierarchyParamT
    def Pack(self, builder):
        if self.objectId is not None:
            objectId = builder.CreateString(self.objectId)
        DumpObjectsHierarchyParamStart(builder)
        if self.objectId is not None:
            DumpObjectsHierarchyParamAddObjectId(builder, objectId)
        DumpObjectsHierarchyParamAddDepth(builder, self.depth)
        dumpObjectsHierarchyParam = DumpObjectsHierarchyParamEnd(builder)
        return dumpObjectsHierarchyParam
