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

package report

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

type Route struct {
	_tab flatbuffers.Table
}

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

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

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

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

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

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

func (rcv *Route) Planet() uint64 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return rcv._tab.GetUint64(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *Route) MutatePlanet(n uint64) bool {
	return rcv._tab.MutateUint64Slot(4, n)
}

func (rcv *Route) Route(obj *RouteEntry, j int) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		x := rcv._tab.Vector(o)
		x += flatbuffers.UOffsetT(j) * 4
		x = rcv._tab.Indirect(x)
		obj.Init(rcv._tab.Bytes, x)
		return true
	}
	return false
}

func (rcv *Route) RouteLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func RouteStart(builder *flatbuffers.Builder) {
	builder.StartObject(2)
}
func RouteAddPlanet(builder *flatbuffers.Builder, planet uint64) {
	builder.PrependUint64Slot(0, planet, 0)
}
func RouteAddRoute(builder *flatbuffers.Builder, route flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(route), 0)
}
func RouteStartRouteVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func RouteEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}
