# automatically generated by the FlatBuffers compiler, do not modify

# namespace: flatbuf

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

# ----------------------------------------------------------------------
# A Buffer represents a single contiguous memory segment
class Buffer(object):
    __slots__ = ['_tab']

    @classmethod
    def SizeOf(cls):
        return 16

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

    # The relative offset into the shared memory page where the bytes for this
    # buffer starts
    # Buffer
    def Offset(self): return self._tab.Get(flatbuffers.number_types.Int64Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0))
    # The absolute length (in bytes) of the memory buffer. The memory is found
    # from offset (inclusive) to offset + length (non-inclusive). When building
    # messages using the encapsulated IPC message, padding bytes may be written
    # after a buffer, but such padding bytes do not need to be accounted for in
    # the size here.
    # Buffer
    def Length(self): return self._tab.Get(flatbuffers.number_types.Int64Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(8))

def CreateBuffer(builder, offset, length):
    builder.Prep(8, 16)
    builder.PrependInt64(length)
    builder.PrependInt64(offset)
    return builder.Offset()
