# automatically generated by the FlatBuffers compiler, do not modify

# namespace: feather_v1_fbs

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

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

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

    @classmethod
    def GetRootAsCTable(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # CTable
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Some text (or a name) metadata about what the file is, optional
    # CTable
    def Description(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

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

    # CTable
    def Columns(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from feather_v1_fbs.Column import Column
            obj = Column()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # CTable
    def ColumnsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # CTable
    def ColumnsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        return o == 0

    # Version number of the Feather format
    #
    # Internal versions 0, 1, and 2: Implemented in Apache Arrow <= 0.16.0 and
    # wesm/feather. Uses "custom" metadata defined in this file.
    # CTable
    def Version(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # Table metadata (likely JSON), not yet used
    # CTable
    def Metadata(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

def Start(builder): builder.StartObject(5)
def CTableStart(builder):
    """This method is deprecated. Please switch to Start."""
    return Start(builder)
def AddDescription(builder, description): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(description), 0)
def CTableAddDescription(builder, description):
    """This method is deprecated. Please switch to AddDescription."""
    return AddDescription(builder, description)
def AddNumRows(builder, numRows): builder.PrependInt64Slot(1, numRows, 0)
def CTableAddNumRows(builder, numRows):
    """This method is deprecated. Please switch to AddNumRows."""
    return AddNumRows(builder, numRows)
def AddColumns(builder, columns): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(columns), 0)
def CTableAddColumns(builder, columns):
    """This method is deprecated. Please switch to AddColumns."""
    return AddColumns(builder, columns)
def StartColumnsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def CTableStartColumnsVector(builder, numElems):
    """This method is deprecated. Please switch to Start."""
    return StartColumnsVector(builder, numElems)
def AddVersion(builder, version): builder.PrependInt32Slot(3, version, 0)
def CTableAddVersion(builder, version):
    """This method is deprecated. Please switch to AddVersion."""
    return AddVersion(builder, version)
def AddMetadata(builder, metadata): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(metadata), 0)
def CTableAddMetadata(builder, metadata):
    """This method is deprecated. Please switch to AddMetadata."""
    return AddMetadata(builder, metadata)
def End(builder): return builder.EndObject()
def CTableEnd(builder):
    """This method is deprecated. Please switch to End."""
    return End(builder)