# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

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

# A field present within each element in a byte array of packed elements.
class PackedElementField(object):
    __slots__ = ['_tab']

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

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

    # Name of the field
    # PackedElementField
    def Name(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

    # Byte offset from start of data buffer
    # PackedElementField
    def Offset(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
        return 0

    # Type of data in the field. Integers are stored using little-endian byte order.
    # PackedElementField
    def Type(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 0

def PackedElementFieldStart(builder): builder.StartObject(3)
def Start(builder):
    return PackedElementFieldStart(builder)
def PackedElementFieldAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
def AddName(builder, name):
    return PackedElementFieldAddName(builder, name)
def PackedElementFieldAddOffset(builder, offset): builder.PrependUint32Slot(1, offset, 0)
def AddOffset(builder, offset):
    return PackedElementFieldAddOffset(builder, offset)
def PackedElementFieldAddType(builder, type): builder.PrependUint8Slot(2, type, 0)
def AddType(builder, type):
    return PackedElementFieldAddType(builder, type)
def PackedElementFieldEnd(builder): return builder.EndObject()
def End(builder):
    return PackedElementFieldEnd(builder)