# automatically generated by the FlatBuffers compiler, do not modify

# namespace: dv

import flatbuffers

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

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

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

# /// Central timestamp (µs), corresponds to exposure midpoint.
    # Frame
    def Timestamp(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
        return 0

# /// Start of Frame (SOF) timestamp.
    # Frame
    def TimestampStartOfFrame(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
        return 0

# /// End of Frame (EOF) timestamp.
    # Frame
    def TimestampEndOfFrame(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
        return 0

# /// Start of Exposure (SOE) timestamp.
    # Frame
    def TimestampStartOfExposure(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
        return 0

# /// End of Exposure (EOE) timestamp.
    # Frame
    def TimestampEndOfExposure(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
        return 0

# /// Pixel format (grayscale, RGB, ...).
    # Frame
    def Format(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 0

# /// X axis length in pixels.
    # Frame
    def SizeX(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 0

# /// Y axis length in pixels.
    # Frame
    def SizeY(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 0

# /// X axis position (upper left offset) in pixels.
    # Frame
    def PositionX(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 0

# /// Y axis position (upper left offset) in pixels.
    # Frame
    def PositionY(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 0

# /// Pixel values, 8bit depth.
    # Frame
    def Pixels(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
        return 0

    # Frame
    def PixelsAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # Frame
    def PixelsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

def FrameStart(builder): builder.StartObject(11)
def FrameAddTimestamp(builder, timestamp): builder.PrependInt64Slot(0, timestamp, 0)
def FrameAddTimestampStartOfFrame(builder, timestampStartOfFrame): builder.PrependInt64Slot(1, timestampStartOfFrame, 0)
def FrameAddTimestampEndOfFrame(builder, timestampEndOfFrame): builder.PrependInt64Slot(2, timestampEndOfFrame, 0)
def FrameAddTimestampStartOfExposure(builder, timestampStartOfExposure): builder.PrependInt64Slot(3, timestampStartOfExposure, 0)
def FrameAddTimestampEndOfExposure(builder, timestampEndOfExposure): builder.PrependInt64Slot(4, timestampEndOfExposure, 0)
def FrameAddFormat(builder, format): builder.PrependInt8Slot(5, format, 0)
def FrameAddSizeX(builder, sizeX): builder.PrependInt16Slot(6, sizeX, 0)
def FrameAddSizeY(builder, sizeY): builder.PrependInt16Slot(7, sizeY, 0)
def FrameAddPositionX(builder, positionX): builder.PrependInt16Slot(8, positionX, 0)
def FrameAddPositionY(builder, positionY): builder.PrependInt16Slot(9, positionY, 0)
def FrameAddPixels(builder, pixels): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(pixels), 0)
def FrameStartPixelsVector(builder, numElems): return builder.StartVector(1, numElems, 1)
def FrameEnd(builder): return builder.EndObject()
