# automatically generated by the FlatBuffers compiler, do not modify

# namespace: flatbuf

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

# For sending dictionary encoding information. Any Field can be
# dictionary-encoded, but in this case none of its children may be
# dictionary-encoded.
# There is one vector / column per dictionary, but that vector / column
# may be spread across multiple dictionary batches by using the isDelta
# flag
class DictionaryBatch(object):
    __slots__ = ['_tab']

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

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

    # DictionaryBatch
    def Id(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

    # DictionaryBatch
    def Data(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from vast_flatbuf.org.apache.arrow.flatbuf.RecordBatch import RecordBatch
            obj = RecordBatch()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # If isDelta is true the values in the dictionary are to be appended to a
    # dictionary with the indicated id. If isDelta is false this dictionary
    # should replace the existing dictionary.
    # DictionaryBatch
    def IsDelta(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

def Start(builder): builder.StartObject(3)
def DictionaryBatchStart(builder):
    """This method is deprecated. Please switch to Start."""
    return Start(builder)
def AddId(builder, id): builder.PrependInt64Slot(0, id, 0)
def DictionaryBatchAddId(builder, id):
    """This method is deprecated. Please switch to AddId."""
    return AddId(builder, id)
def AddData(builder, data): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0)
def DictionaryBatchAddData(builder, data):
    """This method is deprecated. Please switch to AddData."""
    return AddData(builder, data)
def AddIsDelta(builder, isDelta): builder.PrependBoolSlot(2, isDelta, 0)
def DictionaryBatchAddIsDelta(builder, isDelta):
    """This method is deprecated. Please switch to AddIsDelta."""
    return AddIsDelta(builder, isDelta)
def End(builder): return builder.EndObject()
def DictionaryBatchEnd(builder):
    """This method is deprecated. Please switch to End."""
    return End(builder)