// Code generated by the FlatBuffers compiler. DO NOT EDIT.

package lextwt

import (
	flatbuffers "github.com/google/flatbuffers/go"
)

type Msg struct {
	_tab flatbuffers.Table
}

func GetRootAsMsg(buf []byte, offset flatbuffers.UOffsetT) *Msg {
	n := flatbuffers.GetUOffsetT(buf[offset:])
	x := &Msg{}
	x.Init(buf, n+offset)
	return x
}

func FinishMsgBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
	builder.Finish(offset)
}

func GetSizePrefixedRootAsMsg(buf []byte, offset flatbuffers.UOffsetT) *Msg {
	n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
	x := &Msg{}
	x.Init(buf, n+offset+flatbuffers.SizeUint32)
	return x
}

func FinishSizePrefixedMsgBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
	builder.FinishSizePrefixed(offset)
}

func (rcv *Msg) Init(buf []byte, i flatbuffers.UOffsetT) {
	rcv._tab.Bytes = buf
	rcv._tab.Pos = i
}

func (rcv *Msg) Table() flatbuffers.Table {
	return rcv._tab
}

func (rcv *Msg) ElemType() Elem {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return Elem(rcv._tab.GetByte(o + rcv._tab.Pos))
	}
	return 0
}

func (rcv *Msg) MutateElemType(n Elem) bool {
	return rcv._tab.MutateByteSlot(4, byte(n))
}

func (rcv *Msg) Elem(obj *flatbuffers.Table) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		rcv._tab.Union(obj, o)
		return true
	}
	return false
}

func MsgStart(builder *flatbuffers.Builder) {
	builder.StartObject(2)
}
func MsgAddElemType(builder *flatbuffers.Builder, elemType Elem) {
	builder.PrependByteSlot(0, byte(elemType), 0)
}
func MsgAddElem(builder *flatbuffers.Builder, elem flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(elem), 0)
}
func MsgEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}
