# automatically generated by the FlatBuffers compiler, do not modify

# namespace: isp

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

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

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

    @classmethod
    def GetRootAsCommand(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    @classmethod
    def CommandBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
        return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x49\x53\x50\x46", size_prefixed=size_prefixed)

    # Command
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Command
    def Cmd(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

    # Command
    def Step(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from communications.isp.Step import Step
            obj = Step()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Command
    def TensorArgs(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from communications.isp.Tensor import Tensor
            obj = Tensor()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

def CommandStart(builder): builder.StartObject(3)
def Start(builder):
    return CommandStart(builder)
def CommandAddCmd(builder, cmd): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(cmd), 0)
def AddCmd(builder, cmd):
    return CommandAddCmd(builder, cmd)
def CommandAddStep(builder, step): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(step), 0)
def AddStep(builder, step):
    return CommandAddStep(builder, step)
def CommandAddTensorArgs(builder, tensorArgs): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(tensorArgs), 0)
def AddTensorArgs(builder, tensorArgs):
    return CommandAddTensorArgs(builder, tensorArgs)
def CommandEnd(builder): return builder.EndObject()
def End(builder):
    return CommandEnd(builder)