# automatically generated by the FlatBuffers compiler, do not modify

# namespace:

import flatbuffers
from flatbuffers.compat import import_numpy

np = import_numpy()


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

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

    @classmethod
    def GetRootAsEpicsPVConnectionInfo(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)

    @classmethod
    def EpicsPVConnectionInfoBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
        return flatbuffers.util.BufferHasIdentifier(
            buf, offset, b"\x70\x76\x43\x6E", size_prefixed=size_prefixed
        )

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

    # EpicsPVConnectionInfo
    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

    # EpicsPVConnectionInfo
    def Status(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
        return 0

    # EpicsPVConnectionInfo
    def SourceName(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

    # EpicsPVConnectionInfo
    def ServiceId(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None


def EpicsPVConnectionInfoStart(builder):
    builder.StartObject(4)


def Start(builder):
    return EpicsPVConnectionInfoStart(builder)


def EpicsPVConnectionInfoAddTimestamp(builder, timestamp):
    builder.PrependInt64Slot(0, timestamp, 0)


def AddTimestamp(builder, timestamp):
    return EpicsPVConnectionInfoAddTimestamp(builder, timestamp)


def EpicsPVConnectionInfoAddStatus(builder, status):
    builder.PrependInt16Slot(1, status, 0)


def AddStatus(builder, status):
    return EpicsPVConnectionInfoAddStatus(builder, status)


def EpicsPVConnectionInfoAddSourceName(builder, sourceName):
    builder.PrependUOffsetTRelativeSlot(
        2, flatbuffers.number_types.UOffsetTFlags.py_type(sourceName), 0
    )


def AddSourceName(builder, sourceName):
    return EpicsPVConnectionInfoAddSourceName(builder, sourceName)


def EpicsPVConnectionInfoAddServiceId(builder, serviceId):
    builder.PrependUOffsetTRelativeSlot(
        3, flatbuffers.number_types.UOffsetTFlags.py_type(serviceId), 0
    )


def AddServiceId(builder, serviceId):
    return EpicsPVConnectionInfoAddServiceId(builder, serviceId)


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


def End(builder):
    return EpicsPVConnectionInfoEnd(builder)
