# automatically generated by the FlatBuffers compiler, do not modify

# namespace: aghast_generated

import flatbuffers

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

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

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

    # Chunk
    def ColumnChunks(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 .ColumnChunk import ColumnChunk
            obj = ColumnChunk()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

    # Chunk
    def Metadata(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .Metadata import Metadata
            obj = Metadata()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

def ChunkStart(builder): builder.StartObject(2)
def ChunkAddColumnChunks(builder, columnChunks): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(columnChunks), 0)
def ChunkStartColumnChunksVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def ChunkAddMetadata(builder, metadata): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(metadata), 0)
def ChunkEnd(builder): return builder.EndObject()
