# automatically generated by the FlatBuffers compiler, do not modify

# namespace:

import flatbuffers


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

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

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

    # EpicsConnectionInfo
    def Timestamp(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(
                flatbuffers.number_types.Uint64Flags, o + self._tab.Pos
            )
        return 0

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

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

    # EpicsConnectionInfo
    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 EpicsConnectionInfoStart(builder):
    builder.StartObject(4)


def EpicsConnectionInfoAddTimestamp(builder, timestamp):
    builder.PrependUint64Slot(0, timestamp, 0)


def EpicsConnectionInfoAddType(builder, type):
    builder.PrependUint16Slot(1, type, 0)


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


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


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