# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

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

# An array of timestamped poses for an object or reference frame in 3D space
class PosesInFrame(object):
    __slots__ = ['_tab']

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

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

    # Timestamp of pose
    # PosesInFrame
    def Timestamp(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = o + self._tab.Pos
            from .Time import Time
            obj = Time()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Frame of reference for pose position and orientation
    # PosesInFrame
    def FrameId(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

    # Poses in 3D space
    # PosesInFrame
    def Poses(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 .Pose import Pose
            obj = Pose()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

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

def PosesInFrameStart(builder): builder.StartObject(3)
def Start(builder):
    return PosesInFrameStart(builder)
def PosesInFrameAddTimestamp(builder, timestamp): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(timestamp), 0)
def AddTimestamp(builder, timestamp):
    return PosesInFrameAddTimestamp(builder, timestamp)
def PosesInFrameAddFrameId(builder, frameId): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(frameId), 0)
def AddFrameId(builder, frameId):
    return PosesInFrameAddFrameId(builder, frameId)
def PosesInFrameAddPoses(builder, poses): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(poses), 0)
def AddPoses(builder, poses):
    return PosesInFrameAddPoses(builder, poses)
def PosesInFrameStartPosesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartPosesVector(builder, numElems):
    return PosesInFrameStartPosesVector(builder, numElems)
def PosesInFrameEnd(builder): return builder.EndObject()
def End(builder):
    return PosesInFrameEnd(builder)