# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

    # IfParam
    def ThenGraph(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

    # IfParam
    def ElseGraph(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # IfParam
    def AliasesInputs(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            obj = StringVec()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # IfParam
    def AliasesInputsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # IfParam
    def AliasesInputsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        return o == 0

    # IfParam
    def AliasesOutputs(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            obj = StringVec()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # IfParam
    def AliasesOutputsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # IfParam
    def AliasesOutputsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        return o == 0

def IfParamStart(builder): builder.StartObject(4)
def Start(builder):
    return IfParamStart(builder)
def IfParamAddThenGraph(builder, thenGraph): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(thenGraph), 0)
def AddThenGraph(builder, thenGraph):
    return IfParamAddThenGraph(builder, thenGraph)
def IfParamAddElseGraph(builder, elseGraph): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(elseGraph), 0)
def AddElseGraph(builder, elseGraph):
    return IfParamAddElseGraph(builder, elseGraph)
def IfParamAddAliasesInputs(builder, aliasesInputs): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(aliasesInputs), 0)
def AddAliasesInputs(builder, aliasesInputs):
    return IfParamAddAliasesInputs(builder, aliasesInputs)
def IfParamStartAliasesInputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartAliasesInputsVector(builder, numElems):
    return IfParamStartAliasesInputsVector(builder, numElems)
def IfParamAddAliasesOutputs(builder, aliasesOutputs): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(aliasesOutputs), 0)
def AddAliasesOutputs(builder, aliasesOutputs):
    return IfParamAddAliasesOutputs(builder, aliasesOutputs)
def IfParamStartAliasesOutputsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartAliasesOutputsVector(builder, numElems):
    return IfParamStartAliasesOutputsVector(builder, numElems)
def IfParamEnd(builder): return builder.EndObject()
def End(builder):
    return IfParamEnd(builder)