# automatically generated by the FlatBuffers compiler, do not modify

# namespace: FB_Tables

import flatbuffers


class NDAttribute(object):
    __slots__ = ["_tab"]

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

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

    # NDAttribute
    def PName(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

    # NDAttribute
    def PDescription(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

    # NDAttribute
    def PSource(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # NDAttribute
    def DataType(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
        return 0

    # NDAttribute
    def PData(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        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

    # NDAttribute
    def PDataAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # NDAttribute
    def PDataLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0


def NDAttributeStart(builder):
    builder.StartObject(5)


def NDAttributeAddPName(builder, pName):
    builder.PrependUOffsetTRelativeSlot(
        0, flatbuffers.number_types.UOffsetTFlags.py_type(pName), 0
    )


def NDAttributeAddPDescription(builder, pDescription):
    builder.PrependUOffsetTRelativeSlot(
        1, flatbuffers.number_types.UOffsetTFlags.py_type(pDescription), 0
    )


def NDAttributeAddPSource(builder, pSource):
    builder.PrependUOffsetTRelativeSlot(
        2, flatbuffers.number_types.UOffsetTFlags.py_type(pSource), 0
    )


def NDAttributeAddDataType(builder, dataType):
    builder.PrependInt8Slot(3, dataType, 0)


def NDAttributeAddPData(builder, pData):
    builder.PrependUOffsetTRelativeSlot(
        4, flatbuffers.number_types.UOffsetTFlags.py_type(pData), 0
    )


def NDAttributeStartPDataVector(builder, numElems):
    return builder.StartVector(1, numElems, 1)


def NDAttributeEnd(builder):
    return builder.EndObject()
