# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

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

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

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

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

    # RegionCommand
    def Op(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            obj = Op()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # RegionCommand
    def Steps(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # RegionCommand
    def StepsAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
        return 0

    # RegionCommand
    def StepsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # RegionCommand
    def StepsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        return o == 0

    # RegionCommand
    def Size(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # RegionCommand
    def SizeAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
        return 0

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

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

    # RegionCommand
    def Indexes(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # RegionCommand
    def IndexesAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
        return 0

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

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

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

    # RegionCommand
    def ViewLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # RegionCommand
    def ViewIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        return o == 0

    # RegionCommand
    def Fuse(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return -1

    # RegionCommand
    def IterIndexes(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Int32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # RegionCommand
    def IterIndexesAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int32Flags, o)
        return 0

    # RegionCommand
    def IterIndexesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # RegionCommand
    def IterIndexesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        return o == 0

def RegionCommandStart(builder): builder.StartObject(7)
def Start(builder):
    return RegionCommandStart(builder)
def RegionCommandAddOp(builder, op): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(op), 0)
def AddOp(builder, op):
    return RegionCommandAddOp(builder, op)
def RegionCommandAddSteps(builder, steps): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(steps), 0)
def AddSteps(builder, steps):
    return RegionCommandAddSteps(builder, steps)
def RegionCommandStartStepsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartStepsVector(builder, numElems):
    return RegionCommandStartStepsVector(builder, numElems)
def RegionCommandAddSize(builder, size): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(size), 0)
def AddSize(builder, size):
    return RegionCommandAddSize(builder, size)
def RegionCommandStartSizeVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartSizeVector(builder, numElems):
    return RegionCommandStartSizeVector(builder, numElems)
def RegionCommandAddIndexes(builder, indexes): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(indexes), 0)
def AddIndexes(builder, indexes):
    return RegionCommandAddIndexes(builder, indexes)
def RegionCommandStartIndexesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartIndexesVector(builder, numElems):
    return RegionCommandStartIndexesVector(builder, numElems)
def RegionCommandAddView(builder, view): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(view), 0)
def AddView(builder, view):
    return RegionCommandAddView(builder, view)
def RegionCommandStartViewVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartViewVector(builder, numElems):
    return RegionCommandStartViewVector(builder, numElems)
def RegionCommandAddFuse(builder, fuse): builder.PrependInt32Slot(5, fuse, -1)
def AddFuse(builder, fuse):
    return RegionCommandAddFuse(builder, fuse)
def RegionCommandAddIterIndexes(builder, iterIndexes): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(iterIndexes), 0)
def AddIterIndexes(builder, iterIndexes):
    return RegionCommandAddIterIndexes(builder, iterIndexes)
def RegionCommandStartIterIndexesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartIterIndexesVector(builder, numElems):
    return RegionCommandStartIterIndexesVector(builder, numElems)
def RegionCommandEnd(builder): return builder.EndObject()
def End(builder):
    return RegionCommandEnd(builder)