# automatically generated by the FlatBuffers compiler, do not modify

# namespace: flatbuf

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

# Access the data of a field
class FieldRef(object):
    __slots__ = ['_tab']

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

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

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

    # FieldRef
    def Ref(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            from flatbuffers.table import Table
            obj = Table(bytearray(), 0)
            self._tab.Union(obj, o)
            return obj
        return None

    # For Expressions which might reference fields in multiple Relations,
    # this index may be provided to indicate which Relation's fields
    # `ref` points into. For example in the case of a join,
    # 0 refers to the left relation and 1 to the right relation.
    # FieldRef
    def RelationIndex(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

def Start(builder): builder.StartObject(3)
def FieldRefStart(builder):
    """This method is deprecated. Please switch to Start."""
    return Start(builder)
def AddRefType(builder, refType): builder.PrependUint8Slot(0, refType, 0)
def FieldRefAddRefType(builder, refType):
    """This method is deprecated. Please switch to AddRefType."""
    return AddRefType(builder, refType)
def AddRef(builder, ref): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(ref), 0)
def FieldRefAddRef(builder, ref):
    """This method is deprecated. Please switch to AddRef."""
    return AddRef(builder, ref)
def AddRelationIndex(builder, relationIndex): builder.PrependInt32Slot(2, relationIndex, 0)
def FieldRefAddRelationIndex(builder, relationIndex):
    """This method is deprecated. Please switch to AddRelationIndex."""
    return AddRelationIndex(builder, relationIndex)
def End(builder): return builder.EndObject()
def FieldRefEnd(builder):
    """This method is deprecated. Please switch to End."""
    return End(builder)