# automatically generated by the FlatBuffers compiler, do not modify

# namespace: API

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

class ListSourcesResponse(object):
    __slots__ = ['_tab']

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

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

    # ListSourcesResponse
    def Sources(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from SEAScope.API.Source import Source
            obj = Source()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # ListSourcesResponse
    def SourcesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # ListSourcesResponse
    def SourcesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        return o == 0

def ListSourcesResponseStart(builder): builder.StartObject(1)
def ListSourcesResponseAddSources(builder, sources): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(sources), 0)
def ListSourcesResponseStartSourcesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def ListSourcesResponseEnd(builder): return builder.EndObject()
