package flatbuffers

// Table wraps a byte slice and provides read access to its data.
//
// The variable `Pos` indicates the root of the FlatBuffers object therein.
type Table struct {
	Bytes []byte
	Pos   UOffsetT // Always < 1<<31.
}

// Offset provides access into the Table's vtable.
//
// Fields which are deprecated are ignored by checking against the vtable's length.
func ( *Table) ( VOffsetT) VOffsetT {
	 := UOffsetT(SOffsetT(.Pos) - .GetSOffsetT(.Pos))
	if  < .GetVOffsetT() {
		return .GetVOffsetT( + UOffsetT())
	}
	return 0
}

// Indirect retrieves the relative offset stored at `offset`.
func ( *Table) ( UOffsetT) UOffsetT {
	return  + GetUOffsetT(.Bytes[:])
}

// String gets a string from data stored inside the flatbuffer.
func ( *Table) ( UOffsetT) string {
	 := .ByteVector()
	return byteSliceToString()
}

// ByteVector gets a byte slice from data stored inside the flatbuffer.
func ( *Table) ( UOffsetT) []byte {
	 += GetUOffsetT(.Bytes[:])
	 :=  + UOffsetT(SizeUOffsetT)
	 := GetUOffsetT(.Bytes[:])
	return .Bytes[ : +]
}

// VectorLen retrieves the length of the vector whose offset is stored at
// "off" in this object.
func ( *Table) ( UOffsetT) int {
	 += .Pos
	 += GetUOffsetT(.Bytes[:])
	return int(GetUOffsetT(.Bytes[:]))
}

// Vector retrieves the start of data of the vector whose offset is stored
// at "off" in this object.
func ( *Table) ( UOffsetT) UOffsetT {
	 += .Pos
	 :=  + GetUOffsetT(.Bytes[:])
	// data starts after metadata containing the vector length
	 += UOffsetT(SizeUOffsetT)
	return 
}

// Union initializes any Table-derived type to point to the union at the given
// offset.
func ( *Table) ( *Table,  UOffsetT) {
	 += .Pos
	.Pos =  + .GetUOffsetT()
	.Bytes = .Bytes
}

// GetBool retrieves a bool at the given offset.
func ( *Table) ( UOffsetT) bool {
	return GetBool(.Bytes[:])
}

// GetByte retrieves a byte at the given offset.
func ( *Table) ( UOffsetT) byte {
	return GetByte(.Bytes[:])
}

// GetUint8 retrieves a uint8 at the given offset.
func ( *Table) ( UOffsetT) uint8 {
	return GetUint8(.Bytes[:])
}

// GetUint16 retrieves a uint16 at the given offset.
func ( *Table) ( UOffsetT) uint16 {
	return GetUint16(.Bytes[:])
}

// GetUint32 retrieves a uint32 at the given offset.
func ( *Table) ( UOffsetT) uint32 {
	return GetUint32(.Bytes[:])
}

// GetUint64 retrieves a uint64 at the given offset.
func ( *Table) ( UOffsetT) uint64 {
	return GetUint64(.Bytes[:])
}

// GetInt8 retrieves a int8 at the given offset.
func ( *Table) ( UOffsetT) int8 {
	return GetInt8(.Bytes[:])
}

// GetInt16 retrieves a int16 at the given offset.
func ( *Table) ( UOffsetT) int16 {
	return GetInt16(.Bytes[:])
}

// GetInt32 retrieves a int32 at the given offset.
func ( *Table) ( UOffsetT) int32 {
	return GetInt32(.Bytes[:])
}

// GetInt64 retrieves a int64 at the given offset.
func ( *Table) ( UOffsetT) int64 {
	return GetInt64(.Bytes[:])
}

// GetFloat32 retrieves a float32 at the given offset.
func ( *Table) ( UOffsetT) float32 {
	return GetFloat32(.Bytes[:])
}

// GetFloat64 retrieves a float64 at the given offset.
func ( *Table) ( UOffsetT) float64 {
	return GetFloat64(.Bytes[:])
}

// GetUOffsetT retrieves a UOffsetT at the given offset.
func ( *Table) ( UOffsetT) UOffsetT {
	return GetUOffsetT(.Bytes[:])
}

// GetVOffsetT retrieves a VOffsetT at the given offset.
func ( *Table) ( UOffsetT) VOffsetT {
	return GetVOffsetT(.Bytes[:])
}

// GetSOffsetT retrieves a SOffsetT at the given offset.
func ( *Table) ( UOffsetT) SOffsetT {
	return GetSOffsetT(.Bytes[:])
}

// GetBoolSlot retrieves the bool that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  bool) bool {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetBool(.Pos + UOffsetT())
}

// GetByteSlot retrieves the byte that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  byte) byte {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetByte(.Pos + UOffsetT())
}

// GetInt8Slot retrieves the int8 that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  int8) int8 {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetInt8(.Pos + UOffsetT())
}

// GetUint8Slot retrieves the uint8 that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  uint8) uint8 {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetUint8(.Pos + UOffsetT())
}

// GetInt16Slot retrieves the int16 that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  int16) int16 {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetInt16(.Pos + UOffsetT())
}

// GetUint16Slot retrieves the uint16 that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  uint16) uint16 {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetUint16(.Pos + UOffsetT())
}

// GetInt32Slot retrieves the int32 that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  int32) int32 {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetInt32(.Pos + UOffsetT())
}

// GetUint32Slot retrieves the uint32 that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  uint32) uint32 {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetUint32(.Pos + UOffsetT())
}

// GetInt64Slot retrieves the int64 that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  int64) int64 {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetInt64(.Pos + UOffsetT())
}

// GetUint64Slot retrieves the uint64 that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  uint64) uint64 {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetUint64(.Pos + UOffsetT())
}

// GetFloat32Slot retrieves the float32 that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  float32) float32 {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetFloat32(.Pos + UOffsetT())
}

// GetFloat64Slot retrieves the float64 that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  float64) float64 {
	 := .Offset()
	if  == 0 {
		return 
	}

	return .GetFloat64(.Pos + UOffsetT())
}

// GetVOffsetTSlot retrieves the VOffsetT that the given vtable location
// points to. If the vtable value is zero, the default value `d`
// will be returned.
func ( *Table) ( VOffsetT,  VOffsetT) VOffsetT {
	 := .Offset()
	if  == 0 {
		return 
	}
	return VOffsetT()
}

// MutateBool updates a bool at the given offset.
func ( *Table) ( UOffsetT,  bool) bool {
	WriteBool(.Bytes[:], )
	return true
}

// MutateByte updates a Byte at the given offset.
func ( *Table) ( UOffsetT,  byte) bool {
	WriteByte(.Bytes[:], )
	return true
}

// MutateUint8 updates a Uint8 at the given offset.
func ( *Table) ( UOffsetT,  uint8) bool {
	WriteUint8(.Bytes[:], )
	return true
}

// MutateUint16 updates a Uint16 at the given offset.
func ( *Table) ( UOffsetT,  uint16) bool {
	WriteUint16(.Bytes[:], )
	return true
}

// MutateUint32 updates a Uint32 at the given offset.
func ( *Table) ( UOffsetT,  uint32) bool {
	WriteUint32(.Bytes[:], )
	return true
}

// MutateUint64 updates a Uint64 at the given offset.
func ( *Table) ( UOffsetT,  uint64) bool {
	WriteUint64(.Bytes[:], )
	return true
}

// MutateInt8 updates a Int8 at the given offset.
func ( *Table) ( UOffsetT,  int8) bool {
	WriteInt8(.Bytes[:], )
	return true
}

// MutateInt16 updates a Int16 at the given offset.
func ( *Table) ( UOffsetT,  int16) bool {
	WriteInt16(.Bytes[:], )
	return true
}

// MutateInt32 updates a Int32 at the given offset.
func ( *Table) ( UOffsetT,  int32) bool {
	WriteInt32(.Bytes[:], )
	return true
}

// MutateInt64 updates a Int64 at the given offset.
func ( *Table) ( UOffsetT,  int64) bool {
	WriteInt64(.Bytes[:], )
	return true
}

// MutateFloat32 updates a Float32 at the given offset.
func ( *Table) ( UOffsetT,  float32) bool {
	WriteFloat32(.Bytes[:], )
	return true
}

// MutateFloat64 updates a Float64 at the given offset.
func ( *Table) ( UOffsetT,  float64) bool {
	WriteFloat64(.Bytes[:], )
	return true
}

// MutateUOffsetT updates a UOffsetT at the given offset.
func ( *Table) ( UOffsetT,  UOffsetT) bool {
	WriteUOffsetT(.Bytes[:], )
	return true
}

// MutateVOffsetT updates a VOffsetT at the given offset.
func ( *Table) ( UOffsetT,  VOffsetT) bool {
	WriteVOffsetT(.Bytes[:], )
	return true
}

// MutateSOffsetT updates a SOffsetT at the given offset.
func ( *Table) ( UOffsetT,  SOffsetT) bool {
	WriteSOffsetT(.Bytes[:], )
	return true
}

// MutateBoolSlot updates the bool at given vtable location
func ( *Table) ( VOffsetT,  bool) bool {
	if  := .Offset();  != 0 {
		.MutateBool(.Pos+UOffsetT(), )
		return true
	}

	return false
}

// MutateByteSlot updates the byte at given vtable location
func ( *Table) ( VOffsetT,  byte) bool {
	if  := .Offset();  != 0 {
		.MutateByte(.Pos+UOffsetT(), )
		return true
	}

	return false
}

// MutateInt8Slot updates the int8 at given vtable location
func ( *Table) ( VOffsetT,  int8) bool {
	if  := .Offset();  != 0 {
		.MutateInt8(.Pos+UOffsetT(), )
		return true
	}

	return false
}

// MutateUint8Slot updates the uint8 at given vtable location
func ( *Table) ( VOffsetT,  uint8) bool {
	if  := .Offset();  != 0 {
		.MutateUint8(.Pos+UOffsetT(), )
		return true
	}

	return false
}

// MutateInt16Slot updates the int16 at given vtable location
func ( *Table) ( VOffsetT,  int16) bool {
	if  := .Offset();  != 0 {
		.MutateInt16(.Pos+UOffsetT(), )
		return true
	}

	return false
}

// MutateUint16Slot updates the uint16 at given vtable location
func ( *Table) ( VOffsetT,  uint16) bool {
	if  := .Offset();  != 0 {
		.MutateUint16(.Pos+UOffsetT(), )
		return true
	}

	return false
}

// MutateInt32Slot updates the int32 at given vtable location
func ( *Table) ( VOffsetT,  int32) bool {
	if  := .Offset();  != 0 {
		.MutateInt32(.Pos+UOffsetT(), )
		return true
	}

	return false
}

// MutateUint32Slot updates the uint32 at given vtable location
func ( *Table) ( VOffsetT,  uint32) bool {
	if  := .Offset();  != 0 {
		.MutateUint32(.Pos+UOffsetT(), )
		return true
	}

	return false
}

// MutateInt64Slot updates the int64 at given vtable location
func ( *Table) ( VOffsetT,  int64) bool {
	if  := .Offset();  != 0 {
		.MutateInt64(.Pos+UOffsetT(), )
		return true
	}

	return false
}

// MutateUint64Slot updates the uint64 at given vtable location
func ( *Table) ( VOffsetT,  uint64) bool {
	if  := .Offset();  != 0 {
		.MutateUint64(.Pos+UOffsetT(), )
		return true
	}

	return false
}

// MutateFloat32Slot updates the float32 at given vtable location
func ( *Table) ( VOffsetT,  float32) bool {
	if  := .Offset();  != 0 {
		.MutateFloat32(.Pos+UOffsetT(), )
		return true
	}

	return false
}

// MutateFloat64Slot updates the float64 at given vtable location
func ( *Table) ( VOffsetT,  float64) bool {
	if  := .Offset();  != 0 {
		.MutateFloat64(.Pos+UOffsetT(), )
		return true
	}

	return false
}