# automatically generated by the FlatBuffers compiler, do not modify

# namespace: isp

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

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

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

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

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

    # SensorData
    def SensorName(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

    # SensorData
    def Image(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.Tensor import Tensor
            obj = Tensor()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SensorData
    def BoundingBox(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)
            from communications.isp.BoundingBox import BoundingBox
            obj = BoundingBox()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

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

def SensorDataStart(builder): builder.StartObject(3)
def Start(builder):
    return SensorDataStart(builder)
def SensorDataAddSensorName(builder, sensorName): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(sensorName), 0)
def AddSensorName(builder, sensorName):
    return SensorDataAddSensorName(builder, sensorName)
def SensorDataAddImage(builder, image): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(image), 0)
def AddImage(builder, image):
    return SensorDataAddImage(builder, image)
def SensorDataAddBoundingBox(builder, boundingBox): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(boundingBox), 0)
def AddBoundingBox(builder, boundingBox):
    return SensorDataAddBoundingBox(builder, boundingBox)
def SensorDataStartBoundingBoxVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartBoundingBoxVector(builder, numElems):
    return SensorDataStartBoundingBoxVector(builder, numElems)
def SensorDataEnd(builder): return builder.EndObject()
def End(builder):
    return SensorDataEnd(builder)