Merge commit '0f6aab9da6fe982218a01f4a5b896e65fcced437' as 'third_party/flatbuffers'
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct Ability : IFlatbufferObject
|
||||
{
|
||||
private Struct __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Struct(_i, _bb); }
|
||||
public Ability __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public uint Id { get { return __p.bb.GetUint(__p.bb_pos + 0); } }
|
||||
public void MutateId(uint id) { __p.bb.PutUint(__p.bb_pos + 0, id); }
|
||||
public uint Distance { get { return __p.bb.GetUint(__p.bb_pos + 4); } }
|
||||
public void MutateDistance(uint distance) { __p.bb.PutUint(__p.bb_pos + 4, distance); }
|
||||
|
||||
public static Offset<MyGame.Example.Ability> CreateAbility(FlatBufferBuilder builder, uint Id, uint Distance) {
|
||||
builder.Prep(4, 8);
|
||||
builder.PutUint(Distance);
|
||||
builder.PutUint(Id);
|
||||
return new Offset<MyGame.Example.Ability>(builder.Offset);
|
||||
}
|
||||
public AbilityT UnPack() {
|
||||
var _o = new AbilityT();
|
||||
this.UnPackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void UnPackTo(AbilityT _o) {
|
||||
_o.Id = this.Id;
|
||||
_o.Distance = this.Distance;
|
||||
}
|
||||
public static Offset<MyGame.Example.Ability> Pack(FlatBufferBuilder builder, AbilityT _o) {
|
||||
if (_o == null) return default(Offset<MyGame.Example.Ability>);
|
||||
return CreateAbility(
|
||||
builder,
|
||||
_o.Id,
|
||||
_o.Distance);
|
||||
}
|
||||
}
|
||||
|
||||
public class AbilityT
|
||||
{
|
||||
[Newtonsoft.Json.JsonProperty("id")]
|
||||
public uint Id { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("distance")]
|
||||
public uint Distance { get; set; }
|
||||
|
||||
public AbilityT() {
|
||||
this.Id = 0;
|
||||
this.Distance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package Example
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
)
|
||||
|
||||
type AbilityT struct {
|
||||
Id uint32 `json:"id"`
|
||||
Distance uint32 `json:"distance"`
|
||||
}
|
||||
|
||||
func (t *AbilityT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil {
|
||||
return 0
|
||||
}
|
||||
return CreateAbility(builder, t.Id, t.Distance)
|
||||
}
|
||||
func (rcv *Ability) UnPackTo(t *AbilityT) {
|
||||
t.Id = rcv.Id()
|
||||
t.Distance = rcv.Distance()
|
||||
}
|
||||
|
||||
func (rcv *Ability) UnPack() *AbilityT {
|
||||
if rcv == nil {
|
||||
return nil
|
||||
}
|
||||
t := &AbilityT{}
|
||||
rcv.UnPackTo(t)
|
||||
return t
|
||||
}
|
||||
|
||||
type Ability struct {
|
||||
_tab flatbuffers.Struct
|
||||
}
|
||||
|
||||
func (rcv *Ability) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *Ability) Table() flatbuffers.Table {
|
||||
return rcv._tab.Table
|
||||
}
|
||||
|
||||
func (rcv *Ability) Id() uint32 {
|
||||
return rcv._tab.GetUint32(rcv._tab.Pos + flatbuffers.UOffsetT(0))
|
||||
}
|
||||
func (rcv *Ability) MutateId(n uint32) bool {
|
||||
return rcv._tab.MutateUint32(rcv._tab.Pos+flatbuffers.UOffsetT(0), n)
|
||||
}
|
||||
|
||||
func (rcv *Ability) Distance() uint32 {
|
||||
return rcv._tab.GetUint32(rcv._tab.Pos + flatbuffers.UOffsetT(4))
|
||||
}
|
||||
func (rcv *Ability) MutateDistance(n uint32) bool {
|
||||
return rcv._tab.MutateUint32(rcv._tab.Pos+flatbuffers.UOffsetT(4), n)
|
||||
}
|
||||
|
||||
func CreateAbility(builder *flatbuffers.Builder, id uint32, distance uint32) flatbuffers.UOffsetT {
|
||||
builder.Prep(4, 8)
|
||||
builder.PrependUint32(distance)
|
||||
builder.PrependUint32(id)
|
||||
return builder.Offset()
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class Ability extends Struct {
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public Ability __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long id() { return (long)bb.getInt(bb_pos + 0) & 0xFFFFFFFFL; }
|
||||
public void mutateId(long id) { bb.putInt(bb_pos + 0, (int) id); }
|
||||
public long distance() { return (long)bb.getInt(bb_pos + 4) & 0xFFFFFFFFL; }
|
||||
public void mutateDistance(long distance) { bb.putInt(bb_pos + 4, (int) distance); }
|
||||
|
||||
public static int createAbility(FlatBufferBuilder builder, long id, long distance) {
|
||||
builder.prep(4, 8);
|
||||
builder.putInt((int) distance);
|
||||
builder.putInt((int) id);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public Ability get(int j) { return get(new Ability(), j); }
|
||||
public Ability get(Ability obj, int j) { return obj.__assign(__element(j), bb); }
|
||||
}
|
||||
public AbilityT unpack() {
|
||||
AbilityT _o = new AbilityT();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(AbilityT _o) {
|
||||
long _oId = id();
|
||||
_o.setId(_oId);
|
||||
long _oDistance = distance();
|
||||
_o.setDistance(_oDistance);
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, AbilityT _o) {
|
||||
if (_o == null) return 0;
|
||||
return createAbility(
|
||||
builder,
|
||||
_o.getId(),
|
||||
_o.getDistance());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example
|
||||
|
||||
import com.google.flatbuffers.BaseVector
|
||||
import com.google.flatbuffers.BooleanVector
|
||||
import com.google.flatbuffers.ByteVector
|
||||
import com.google.flatbuffers.Constants
|
||||
import com.google.flatbuffers.DoubleVector
|
||||
import com.google.flatbuffers.FlatBufferBuilder
|
||||
import com.google.flatbuffers.FloatVector
|
||||
import com.google.flatbuffers.LongVector
|
||||
import com.google.flatbuffers.StringVector
|
||||
import com.google.flatbuffers.Struct
|
||||
import com.google.flatbuffers.Table
|
||||
import com.google.flatbuffers.UnionVector
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
import kotlin.math.sign
|
||||
|
||||
@Suppress("unused")
|
||||
class Ability : Struct() {
|
||||
|
||||
fun __init(_i: Int, _bb: ByteBuffer) {
|
||||
__reset(_i, _bb)
|
||||
}
|
||||
fun __assign(_i: Int, _bb: ByteBuffer) : Ability {
|
||||
__init(_i, _bb)
|
||||
return this
|
||||
}
|
||||
val id : UInt get() = bb.getInt(bb_pos + 0).toUInt()
|
||||
fun mutateId(id: UInt) : ByteBuffer = bb.putInt(bb_pos + 0, id.toInt())
|
||||
val distance : UInt get() = bb.getInt(bb_pos + 4).toUInt()
|
||||
fun mutateDistance(distance: UInt) : ByteBuffer = bb.putInt(bb_pos + 4, distance.toInt())
|
||||
companion object {
|
||||
fun createAbility(builder: FlatBufferBuilder, id: UInt, distance: UInt) : Int {
|
||||
builder.prep(4, 8)
|
||||
builder.putInt(distance.toInt())
|
||||
builder.putInt(id.toInt())
|
||||
return builder.offset()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
--[[ MyGame.Example.Ability
|
||||
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by : //monster_test.fbs
|
||||
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
|
||||
|
||||
--]]
|
||||
|
||||
local flatbuffers = require('flatbuffers')
|
||||
|
||||
local Ability = {}
|
||||
local mt = {}
|
||||
|
||||
function Ability.New()
|
||||
local o = {}
|
||||
setmetatable(o, {__index = mt})
|
||||
return o
|
||||
end
|
||||
|
||||
function mt:Init(buf, pos)
|
||||
self.view = flatbuffers.view.New(buf, pos)
|
||||
end
|
||||
|
||||
function mt:Id()
|
||||
return self.view:Get(flatbuffers.N.Uint32, self.view.pos + 0)
|
||||
end
|
||||
|
||||
function mt:Distance()
|
||||
return self.view:Get(flatbuffers.N.Uint32, self.view.pos + 4)
|
||||
end
|
||||
|
||||
function Ability.CreateAbility(builder, id, distance)
|
||||
builder:Prep(4, 8)
|
||||
builder:PrependUint32(distance)
|
||||
builder:PrependUint32(id)
|
||||
return builder:Offset()
|
||||
end
|
||||
|
||||
return Ability
|
||||
@@ -0,0 +1,26 @@
|
||||
#[ MyGame.Example.Ability
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by :
|
||||
Rooting type : MyGame.Example.Monster ()
|
||||
]#
|
||||
|
||||
import flatbuffers
|
||||
|
||||
type Ability* = object of FlatObj
|
||||
func id*(self: Ability): uint32 =
|
||||
return Get[uint32](self.tab, self.tab.Pos + 0)
|
||||
func `id=`*(self: var Ability, n: uint32): bool =
|
||||
return self.tab.Mutate(self.tab.Pos + 0, n)
|
||||
func distance*(self: Ability): uint32 =
|
||||
return Get[uint32](self.tab, self.tab.Pos + 4)
|
||||
func `distance=`*(self: var Ability, n: uint32): bool =
|
||||
return self.tab.Mutate(self.tab.Pos + 4, n)
|
||||
proc AbilityCreate*(self: var Builder, id: uint32, distance: uint32): uoffset =
|
||||
self.Prep(4, 8)
|
||||
self.Prepend(distance)
|
||||
self.Prepend(id)
|
||||
return self.Offset()
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace MyGame\Example;
|
||||
|
||||
use \Google\FlatBuffers\Struct;
|
||||
use \Google\FlatBuffers\Table;
|
||||
use \Google\FlatBuffers\ByteBuffer;
|
||||
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||
|
||||
class Ability extends Struct
|
||||
{
|
||||
/**
|
||||
* @param int $_i offset
|
||||
* @param ByteBuffer $_bb
|
||||
* @return Ability
|
||||
**/
|
||||
public function init($_i, ByteBuffer $_bb)
|
||||
{
|
||||
$this->bb_pos = $_i;
|
||||
$this->bb = $_bb;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return uint
|
||||
*/
|
||||
public function GetId()
|
||||
{
|
||||
return $this->bb->getUint($this->bb_pos + 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return uint
|
||||
*/
|
||||
public function GetDistance()
|
||||
{
|
||||
return $this->bb->getUint($this->bb_pos + 4);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return int offset
|
||||
*/
|
||||
public static function createAbility(FlatBufferBuilder $builder, $id, $distance)
|
||||
{
|
||||
$builder->prep(4, 8);
|
||||
$builder->putUint($distance);
|
||||
$builder->putUint($id);
|
||||
return $builder->offset();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
np = import_numpy()
|
||||
|
||||
class Ability(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def SizeOf(cls):
|
||||
return 8
|
||||
|
||||
# Ability
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# Ability
|
||||
def Id(self): return self._tab.Get(flatbuffers.number_types.Uint32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0))
|
||||
# Ability
|
||||
def Distance(self): return self._tab.Get(flatbuffers.number_types.Uint32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(4))
|
||||
|
||||
def CreateAbility(builder, id, distance):
|
||||
builder.Prep(4, 8)
|
||||
builder.PrependUint32(distance)
|
||||
builder.PrependUint32(id)
|
||||
return builder.Offset()
|
||||
|
||||
|
||||
class AbilityT(object):
|
||||
|
||||
# AbilityT
|
||||
def __init__(self):
|
||||
self.id = 0 # type: int
|
||||
self.distance = 0 # type: int
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
ability = Ability()
|
||||
ability.Init(buf, pos)
|
||||
return cls.InitFromObj(ability)
|
||||
|
||||
@classmethod
|
||||
def InitFromPackedBuf(cls, buf, pos=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
||||
return cls.InitFromBuf(buf, pos+n)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, ability):
|
||||
x = AbilityT()
|
||||
x._UnPack(ability)
|
||||
return x
|
||||
|
||||
# AbilityT
|
||||
def _UnPack(self, ability):
|
||||
if ability is None:
|
||||
return
|
||||
self.id = ability.Id()
|
||||
self.distance = ability.Distance()
|
||||
|
||||
# AbilityT
|
||||
def Pack(self, builder):
|
||||
return CreateAbility(builder, self.id, self.distance)
|
||||
@@ -0,0 +1,40 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
public class AbilityT {
|
||||
private long id;
|
||||
private long distance;
|
||||
|
||||
public long getId() { return id; }
|
||||
|
||||
public void setId(long id) { this.id = id; }
|
||||
|
||||
public long getDistance() { return distance; }
|
||||
|
||||
public void setDistance(long distance) { this.distance = distance; }
|
||||
|
||||
|
||||
public AbilityT() {
|
||||
this.id = 0L;
|
||||
this.distance = 0L;
|
||||
}
|
||||
}
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
public enum Any : byte
|
||||
{
|
||||
NONE = 0,
|
||||
Monster = 1,
|
||||
TestSimpleTableWithEnum = 2,
|
||||
MyGame_Example2_Monster = 3,
|
||||
};
|
||||
|
||||
public class AnyUnion {
|
||||
public Any Type { get; set; }
|
||||
public object Value { get; set; }
|
||||
|
||||
public AnyUnion() {
|
||||
this.Type = Any.NONE;
|
||||
this.Value = null;
|
||||
}
|
||||
|
||||
public T As<T>() where T : class { return this.Value as T; }
|
||||
public MyGame.Example.MonsterT AsMonster() { return this.As<MyGame.Example.MonsterT>(); }
|
||||
public static AnyUnion FromMonster(MyGame.Example.MonsterT _monster) { return new AnyUnion{ Type = Any.Monster, Value = _monster }; }
|
||||
internal MyGame.Example.TestSimpleTableWithEnumT AsTestSimpleTableWithEnum() { return this.As<MyGame.Example.TestSimpleTableWithEnumT>(); }
|
||||
internal static AnyUnion FromTestSimpleTableWithEnum(MyGame.Example.TestSimpleTableWithEnumT _testsimpletablewithenum) { return new AnyUnion{ Type = Any.TestSimpleTableWithEnum, Value = _testsimpletablewithenum }; }
|
||||
public MyGame.Example2.MonsterT AsMyGame_Example2_Monster() { return this.As<MyGame.Example2.MonsterT>(); }
|
||||
public static AnyUnion FromMyGame_Example2_Monster(MyGame.Example2.MonsterT _mygame_example2_monster) { return new AnyUnion{ Type = Any.MyGame_Example2_Monster, Value = _mygame_example2_monster }; }
|
||||
|
||||
public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, AnyUnion _o) {
|
||||
switch (_o.Type) {
|
||||
default: return 0;
|
||||
case Any.Monster: return MyGame.Example.Monster.Pack(builder, _o.AsMonster()).Value;
|
||||
case Any.TestSimpleTableWithEnum: return MyGame.Example.TestSimpleTableWithEnum.Pack(builder, _o.AsTestSimpleTableWithEnum()).Value;
|
||||
case Any.MyGame_Example2_Monster: return MyGame.Example2.Monster.Pack(builder, _o.AsMyGame_Example2_Monster()).Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class AnyUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
|
||||
public override bool CanConvert(System.Type objectType) {
|
||||
return objectType == typeof(AnyUnion) || objectType == typeof(System.Collections.Generic.List<AnyUnion>);
|
||||
}
|
||||
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
var _olist = value as System.Collections.Generic.List<AnyUnion>;
|
||||
if (_olist != null) {
|
||||
writer.WriteStartArray();
|
||||
foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
|
||||
writer.WriteEndArray();
|
||||
} else {
|
||||
this.WriteJson(writer, value as AnyUnion, serializer);
|
||||
}
|
||||
}
|
||||
public void WriteJson(Newtonsoft.Json.JsonWriter writer, AnyUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
if (_o == null) return;
|
||||
serializer.Serialize(writer, _o.Value);
|
||||
}
|
||||
public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
var _olist = existingValue as System.Collections.Generic.List<AnyUnion>;
|
||||
if (_olist != null) {
|
||||
for (var _j = 0; _j < _olist.Count; ++_j) {
|
||||
reader.Read();
|
||||
_olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
|
||||
}
|
||||
reader.Read();
|
||||
return _olist;
|
||||
} else {
|
||||
return this.ReadJson(reader, existingValue as AnyUnion, serializer);
|
||||
}
|
||||
}
|
||||
public AnyUnion ReadJson(Newtonsoft.Json.JsonReader reader, AnyUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
if (_o == null) return null;
|
||||
switch (_o.Type) {
|
||||
default: break;
|
||||
case Any.Monster: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
|
||||
case Any.TestSimpleTableWithEnum: _o.Value = serializer.Deserialize<MyGame.Example.TestSimpleTableWithEnumT>(reader); break;
|
||||
case Any.MyGame_Example2_Monster: _o.Value = serializer.Deserialize<MyGame.Example2.MonsterT>(reader); break;
|
||||
}
|
||||
return _o;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public class AnyVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
|
||||
{
|
||||
bool result = true;
|
||||
switch((Any)typeId)
|
||||
{
|
||||
case Any.Monster:
|
||||
result = MyGame.Example.MonsterVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
case Any.TestSimpleTableWithEnum:
|
||||
result = MyGame.Example.TestSimpleTableWithEnumVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
case Any.MyGame_Example2_Monster:
|
||||
result = MyGame.Example2.MonsterVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
default: result = true;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package Example
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
"strconv"
|
||||
|
||||
MyGame__Example2 "MyGame/Example2"
|
||||
)
|
||||
|
||||
type Any byte
|
||||
|
||||
const (
|
||||
AnyNONE Any = 0
|
||||
AnyMonster Any = 1
|
||||
AnyTestSimpleTableWithEnum Any = 2
|
||||
AnyMyGame_Example2_Monster Any = 3
|
||||
)
|
||||
|
||||
var EnumNamesAny = map[Any]string{
|
||||
AnyNONE: "NONE",
|
||||
AnyMonster: "Monster",
|
||||
AnyTestSimpleTableWithEnum: "TestSimpleTableWithEnum",
|
||||
AnyMyGame_Example2_Monster: "MyGame_Example2_Monster",
|
||||
}
|
||||
|
||||
var EnumValuesAny = map[string]Any{
|
||||
"NONE": AnyNONE,
|
||||
"Monster": AnyMonster,
|
||||
"TestSimpleTableWithEnum": AnyTestSimpleTableWithEnum,
|
||||
"MyGame_Example2_Monster": AnyMyGame_Example2_Monster,
|
||||
}
|
||||
|
||||
func (v Any) String() string {
|
||||
if s, ok := EnumNamesAny[v]; ok {
|
||||
return s
|
||||
}
|
||||
return "Any(" + strconv.FormatInt(int64(v), 10) + ")"
|
||||
}
|
||||
|
||||
type AnyT struct {
|
||||
Type Any
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
func (t *AnyT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil {
|
||||
return 0
|
||||
}
|
||||
switch t.Type {
|
||||
case AnyMonster:
|
||||
return t.Value.(*MonsterT).Pack(builder)
|
||||
case AnyTestSimpleTableWithEnum:
|
||||
return t.Value.(*TestSimpleTableWithEnumT).Pack(builder)
|
||||
case AnyMyGame_Example2_Monster:
|
||||
return t.Value.(*MyGame__Example2.MonsterT).Pack(builder)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv Any) UnPack(table flatbuffers.Table) *AnyT {
|
||||
switch rcv {
|
||||
case AnyMonster:
|
||||
var x Monster
|
||||
x.Init(table.Bytes, table.Pos)
|
||||
return &AnyT{Type: AnyMonster, Value: x.UnPack()}
|
||||
case AnyTestSimpleTableWithEnum:
|
||||
var x TestSimpleTableWithEnum
|
||||
x.Init(table.Bytes, table.Pos)
|
||||
return &AnyT{Type: AnyTestSimpleTableWithEnum, Value: x.UnPack()}
|
||||
case AnyMyGame_Example2_Monster:
|
||||
var x MyGame__Example2.Monster
|
||||
x.Init(table.Bytes, table.Pos)
|
||||
return &AnyT{Type: AnyMyGame_Example2_Monster, Value: x.UnPack()}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class Any {
|
||||
private Any() { }
|
||||
public static final byte NONE = 0;
|
||||
public static final byte Monster = 1;
|
||||
public static final byte TestSimpleTableWithEnum = 2;
|
||||
public static final byte MyGame_Example2_Monster = 3;
|
||||
|
||||
public static final String[] names = { "NONE", "Monster", "TestSimpleTableWithEnum", "MyGame_Example2_Monster", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example
|
||||
|
||||
@Suppress("unused")
|
||||
class Any_ private constructor() {
|
||||
companion object {
|
||||
const val NONE: UByte = 0u
|
||||
const val Monster: UByte = 1u
|
||||
const val TestSimpleTableWithEnum: UByte = 2u
|
||||
const val MyGame_Example2_Monster: UByte = 3u
|
||||
val names : Array<String> = arrayOf("NONE", "Monster", "TestSimpleTableWithEnum", "MyGame_Example2_Monster")
|
||||
fun name(e: Int) : String = names[e]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--[[ MyGame.Example.Any
|
||||
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by : //monster_test.fbs
|
||||
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
|
||||
|
||||
--]]
|
||||
|
||||
local Any = {
|
||||
NONE = 0,
|
||||
Monster = 1,
|
||||
TestSimpleTableWithEnum = 2,
|
||||
MyGame_Example2_Monster = 3,
|
||||
}
|
||||
|
||||
return Any
|
||||
@@ -0,0 +1,15 @@
|
||||
#[ MyGame.Example.Any
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by :
|
||||
Rooting type : MyGame.Example.Monster ()
|
||||
]#
|
||||
|
||||
type Any*{.pure.} = enum
|
||||
None = 0.uint8,
|
||||
Monster = 1.uint8,
|
||||
TestSimpleTableWithEnum = 2.uint8,
|
||||
MyGameExample2Monster = 3.uint8,
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace MyGame\Example;
|
||||
|
||||
class Any
|
||||
{
|
||||
const NONE = 0;
|
||||
const Monster = 1;
|
||||
const TestSimpleTableWithEnum = 2;
|
||||
const MyGame_Example2_Monster = 3;
|
||||
|
||||
private static $names = array(
|
||||
Any::NONE=>"NONE",
|
||||
Any::Monster=>"Monster",
|
||||
Any::TestSimpleTableWithEnum=>"TestSimpleTableWithEnum",
|
||||
Any::MyGame_Example2_Monster=>"MyGame_Example2_Monster",
|
||||
);
|
||||
|
||||
public static function Name($e)
|
||||
{
|
||||
if (!isset(self::$names[$e])) {
|
||||
throw new \Exception();
|
||||
}
|
||||
return self::$names[$e];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
class Any(object):
|
||||
NONE = 0
|
||||
Monster = 1
|
||||
TestSimpleTableWithEnum = 2
|
||||
MyGame_Example2_Monster = 3
|
||||
|
||||
def AnyCreator(unionType, table):
|
||||
from flatbuffers.table import Table
|
||||
if not isinstance(table, Table):
|
||||
return None
|
||||
if unionType == Any().Monster:
|
||||
import MyGame.Example.Monster
|
||||
return MyGame.Example.Monster.MonsterT.InitFromBuf(table.Bytes, table.Pos)
|
||||
if unionType == Any().TestSimpleTableWithEnum:
|
||||
import MyGame.Example.TestSimpleTableWithEnum
|
||||
return MyGame.Example.TestSimpleTableWithEnum.TestSimpleTableWithEnumT.InitFromBuf(table.Bytes, table.Pos)
|
||||
if unionType == Any().MyGame_Example2_Monster:
|
||||
import MyGame.Example2.Monster
|
||||
return MyGame.Example2.Monster.MonsterT.InitFromBuf(table.Bytes, table.Pos)
|
||||
return None
|
||||
@@ -0,0 +1,113 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
public enum AnyAmbiguousAliases : byte
|
||||
{
|
||||
NONE = 0,
|
||||
M1 = 1,
|
||||
M2 = 2,
|
||||
M3 = 3,
|
||||
};
|
||||
|
||||
public class AnyAmbiguousAliasesUnion {
|
||||
public AnyAmbiguousAliases Type { get; set; }
|
||||
public object Value { get; set; }
|
||||
|
||||
public AnyAmbiguousAliasesUnion() {
|
||||
this.Type = AnyAmbiguousAliases.NONE;
|
||||
this.Value = null;
|
||||
}
|
||||
|
||||
public T As<T>() where T : class { return this.Value as T; }
|
||||
public MyGame.Example.MonsterT AsM1() { return this.As<MyGame.Example.MonsterT>(); }
|
||||
public static AnyAmbiguousAliasesUnion FromM1(MyGame.Example.MonsterT _m1) { return new AnyAmbiguousAliasesUnion{ Type = AnyAmbiguousAliases.M1, Value = _m1 }; }
|
||||
public MyGame.Example.MonsterT AsM2() { return this.As<MyGame.Example.MonsterT>(); }
|
||||
public static AnyAmbiguousAliasesUnion FromM2(MyGame.Example.MonsterT _m2) { return new AnyAmbiguousAliasesUnion{ Type = AnyAmbiguousAliases.M2, Value = _m2 }; }
|
||||
public MyGame.Example.MonsterT AsM3() { return this.As<MyGame.Example.MonsterT>(); }
|
||||
public static AnyAmbiguousAliasesUnion FromM3(MyGame.Example.MonsterT _m3) { return new AnyAmbiguousAliasesUnion{ Type = AnyAmbiguousAliases.M3, Value = _m3 }; }
|
||||
|
||||
public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, AnyAmbiguousAliasesUnion _o) {
|
||||
switch (_o.Type) {
|
||||
default: return 0;
|
||||
case AnyAmbiguousAliases.M1: return MyGame.Example.Monster.Pack(builder, _o.AsM1()).Value;
|
||||
case AnyAmbiguousAliases.M2: return MyGame.Example.Monster.Pack(builder, _o.AsM2()).Value;
|
||||
case AnyAmbiguousAliases.M3: return MyGame.Example.Monster.Pack(builder, _o.AsM3()).Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class AnyAmbiguousAliasesUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
|
||||
public override bool CanConvert(System.Type objectType) {
|
||||
return objectType == typeof(AnyAmbiguousAliasesUnion) || objectType == typeof(System.Collections.Generic.List<AnyAmbiguousAliasesUnion>);
|
||||
}
|
||||
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
var _olist = value as System.Collections.Generic.List<AnyAmbiguousAliasesUnion>;
|
||||
if (_olist != null) {
|
||||
writer.WriteStartArray();
|
||||
foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
|
||||
writer.WriteEndArray();
|
||||
} else {
|
||||
this.WriteJson(writer, value as AnyAmbiguousAliasesUnion, serializer);
|
||||
}
|
||||
}
|
||||
public void WriteJson(Newtonsoft.Json.JsonWriter writer, AnyAmbiguousAliasesUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
if (_o == null) return;
|
||||
serializer.Serialize(writer, _o.Value);
|
||||
}
|
||||
public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
var _olist = existingValue as System.Collections.Generic.List<AnyAmbiguousAliasesUnion>;
|
||||
if (_olist != null) {
|
||||
for (var _j = 0; _j < _olist.Count; ++_j) {
|
||||
reader.Read();
|
||||
_olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
|
||||
}
|
||||
reader.Read();
|
||||
return _olist;
|
||||
} else {
|
||||
return this.ReadJson(reader, existingValue as AnyAmbiguousAliasesUnion, serializer);
|
||||
}
|
||||
}
|
||||
public AnyAmbiguousAliasesUnion ReadJson(Newtonsoft.Json.JsonReader reader, AnyAmbiguousAliasesUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
if (_o == null) return null;
|
||||
switch (_o.Type) {
|
||||
default: break;
|
||||
case AnyAmbiguousAliases.M1: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
|
||||
case AnyAmbiguousAliases.M2: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
|
||||
case AnyAmbiguousAliases.M3: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
|
||||
}
|
||||
return _o;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public class AnyAmbiguousAliasesVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
|
||||
{
|
||||
bool result = true;
|
||||
switch((AnyAmbiguousAliases)typeId)
|
||||
{
|
||||
case AnyAmbiguousAliases.M1:
|
||||
result = MyGame.Example.MonsterVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
case AnyAmbiguousAliases.M2:
|
||||
result = MyGame.Example.MonsterVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
case AnyAmbiguousAliases.M3:
|
||||
result = MyGame.Example.MonsterVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
default: result = true;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package Example
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type AnyAmbiguousAliases byte
|
||||
|
||||
const (
|
||||
AnyAmbiguousAliasesNONE AnyAmbiguousAliases = 0
|
||||
AnyAmbiguousAliasesM1 AnyAmbiguousAliases = 1
|
||||
AnyAmbiguousAliasesM2 AnyAmbiguousAliases = 2
|
||||
AnyAmbiguousAliasesM3 AnyAmbiguousAliases = 3
|
||||
)
|
||||
|
||||
var EnumNamesAnyAmbiguousAliases = map[AnyAmbiguousAliases]string{
|
||||
AnyAmbiguousAliasesNONE: "NONE",
|
||||
AnyAmbiguousAliasesM1: "M1",
|
||||
AnyAmbiguousAliasesM2: "M2",
|
||||
AnyAmbiguousAliasesM3: "M3",
|
||||
}
|
||||
|
||||
var EnumValuesAnyAmbiguousAliases = map[string]AnyAmbiguousAliases{
|
||||
"NONE": AnyAmbiguousAliasesNONE,
|
||||
"M1": AnyAmbiguousAliasesM1,
|
||||
"M2": AnyAmbiguousAliasesM2,
|
||||
"M3": AnyAmbiguousAliasesM3,
|
||||
}
|
||||
|
||||
func (v AnyAmbiguousAliases) String() string {
|
||||
if s, ok := EnumNamesAnyAmbiguousAliases[v]; ok {
|
||||
return s
|
||||
}
|
||||
return "AnyAmbiguousAliases(" + strconv.FormatInt(int64(v), 10) + ")"
|
||||
}
|
||||
|
||||
type AnyAmbiguousAliasesT struct {
|
||||
Type AnyAmbiguousAliases
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
func (t *AnyAmbiguousAliasesT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil {
|
||||
return 0
|
||||
}
|
||||
switch t.Type {
|
||||
case AnyAmbiguousAliasesM1:
|
||||
return t.Value.(*MonsterT).Pack(builder)
|
||||
case AnyAmbiguousAliasesM2:
|
||||
return t.Value.(*MonsterT).Pack(builder)
|
||||
case AnyAmbiguousAliasesM3:
|
||||
return t.Value.(*MonsterT).Pack(builder)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv AnyAmbiguousAliases) UnPack(table flatbuffers.Table) *AnyAmbiguousAliasesT {
|
||||
switch rcv {
|
||||
case AnyAmbiguousAliasesM1:
|
||||
var x Monster
|
||||
x.Init(table.Bytes, table.Pos)
|
||||
return &AnyAmbiguousAliasesT{Type: AnyAmbiguousAliasesM1, Value: x.UnPack()}
|
||||
case AnyAmbiguousAliasesM2:
|
||||
var x Monster
|
||||
x.Init(table.Bytes, table.Pos)
|
||||
return &AnyAmbiguousAliasesT{Type: AnyAmbiguousAliasesM2, Value: x.UnPack()}
|
||||
case AnyAmbiguousAliasesM3:
|
||||
var x Monster
|
||||
x.Init(table.Bytes, table.Pos)
|
||||
return &AnyAmbiguousAliasesT{Type: AnyAmbiguousAliasesM3, Value: x.UnPack()}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class AnyAmbiguousAliases {
|
||||
private AnyAmbiguousAliases() { }
|
||||
public static final byte NONE = 0;
|
||||
public static final byte M1 = 1;
|
||||
public static final byte M2 = 2;
|
||||
public static final byte M3 = 3;
|
||||
|
||||
public static final String[] names = { "NONE", "M1", "M2", "M3", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example
|
||||
|
||||
@Suppress("unused")
|
||||
class AnyAmbiguousAliases private constructor() {
|
||||
companion object {
|
||||
const val NONE: UByte = 0u
|
||||
const val M1: UByte = 1u
|
||||
const val M2: UByte = 2u
|
||||
const val M3: UByte = 3u
|
||||
val names : Array<String> = arrayOf("NONE", "M1", "M2", "M3")
|
||||
fun name(e: Int) : String = names[e]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--[[ MyGame.Example.AnyAmbiguousAliases
|
||||
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by : //monster_test.fbs
|
||||
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
|
||||
|
||||
--]]
|
||||
|
||||
local AnyAmbiguousAliases = {
|
||||
NONE = 0,
|
||||
M1 = 1,
|
||||
M2 = 2,
|
||||
M3 = 3,
|
||||
}
|
||||
|
||||
return AnyAmbiguousAliases
|
||||
@@ -0,0 +1,15 @@
|
||||
#[ MyGame.Example.AnyAmbiguousAliases
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by :
|
||||
Rooting type : MyGame.Example.Monster ()
|
||||
]#
|
||||
|
||||
type AnyAmbiguousAliases*{.pure.} = enum
|
||||
None = 0.uint8,
|
||||
M1 = 1.uint8,
|
||||
M2 = 2.uint8,
|
||||
M3 = 3.uint8,
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace MyGame\Example;
|
||||
|
||||
class AnyAmbiguousAliases
|
||||
{
|
||||
const NONE = 0;
|
||||
const M1 = 1;
|
||||
const M2 = 2;
|
||||
const M3 = 3;
|
||||
|
||||
private static $names = array(
|
||||
AnyAmbiguousAliases::NONE=>"NONE",
|
||||
AnyAmbiguousAliases::M1=>"M1",
|
||||
AnyAmbiguousAliases::M2=>"M2",
|
||||
AnyAmbiguousAliases::M3=>"M3",
|
||||
);
|
||||
|
||||
public static function Name($e)
|
||||
{
|
||||
if (!isset(self::$names[$e])) {
|
||||
throw new \Exception();
|
||||
}
|
||||
return self::$names[$e];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
class AnyAmbiguousAliases(object):
|
||||
NONE = 0
|
||||
M1 = 1
|
||||
M2 = 2
|
||||
M3 = 3
|
||||
|
||||
def AnyAmbiguousAliasesCreator(unionType, table):
|
||||
from flatbuffers.table import Table
|
||||
if not isinstance(table, Table):
|
||||
return None
|
||||
if unionType == AnyAmbiguousAliases().M1:
|
||||
import MyGame.Example.Monster
|
||||
return MyGame.Example.Monster.MonsterT.InitFromBuf(table.Bytes, table.Pos)
|
||||
if unionType == AnyAmbiguousAliases().M2:
|
||||
import MyGame.Example.Monster
|
||||
return MyGame.Example.Monster.MonsterT.InitFromBuf(table.Bytes, table.Pos)
|
||||
if unionType == AnyAmbiguousAliases().M3:
|
||||
import MyGame.Example.Monster
|
||||
return MyGame.Example.Monster.MonsterT.InitFromBuf(table.Bytes, table.Pos)
|
||||
return None
|
||||
@@ -0,0 +1,37 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
|
||||
public class AnyAmbiguousAliasesUnion {
|
||||
private byte type;
|
||||
private Object value;
|
||||
|
||||
public byte getType() { return type; }
|
||||
|
||||
public void setType(byte type) { this.type = type; }
|
||||
|
||||
public Object getValue() { return value; }
|
||||
|
||||
public void setValue(Object value) { this.value = value; }
|
||||
|
||||
public AnyAmbiguousAliasesUnion() {
|
||||
this.type = AnyAmbiguousAliases.NONE;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public MyGame.Example.MonsterT asM1() { return (MyGame.Example.MonsterT) value; }
|
||||
public MyGame.Example.MonsterT asM2() { return (MyGame.Example.MonsterT) value; }
|
||||
public MyGame.Example.MonsterT asM3() { return (MyGame.Example.MonsterT) value; }
|
||||
|
||||
public static int pack(FlatBufferBuilder builder, AnyAmbiguousAliasesUnion _o) {
|
||||
switch (_o.type) {
|
||||
case AnyAmbiguousAliases.M1: return MyGame.Example.Monster.pack(builder, _o.asM1());
|
||||
case AnyAmbiguousAliases.M2: return MyGame.Example.Monster.pack(builder, _o.asM2());
|
||||
case AnyAmbiguousAliases.M3: return MyGame.Example.Monster.pack(builder, _o.asM3());
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
|
||||
public class AnyUnion {
|
||||
private byte type;
|
||||
private Object value;
|
||||
|
||||
public byte getType() { return type; }
|
||||
|
||||
public void setType(byte type) { this.type = type; }
|
||||
|
||||
public Object getValue() { return value; }
|
||||
|
||||
public void setValue(Object value) { this.value = value; }
|
||||
|
||||
public AnyUnion() {
|
||||
this.type = Any.NONE;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public MyGame.Example.MonsterT asMonster() { return (MyGame.Example.MonsterT) value; }
|
||||
MyGame.Example.TestSimpleTableWithEnumT asTestSimpleTableWithEnum() { return (MyGame.Example.TestSimpleTableWithEnumT) value; }
|
||||
public MyGame.Example2.MonsterT asMyGame_Example2_Monster() { return (MyGame.Example2.MonsterT) value; }
|
||||
|
||||
public static int pack(FlatBufferBuilder builder, AnyUnion _o) {
|
||||
switch (_o.type) {
|
||||
case Any.Monster: return MyGame.Example.Monster.pack(builder, _o.asMonster());
|
||||
case Any.TestSimpleTableWithEnum: return MyGame.Example.TestSimpleTableWithEnum.pack(builder, _o.asTestSimpleTableWithEnum());
|
||||
case Any.MyGame_Example2_Monster: return MyGame.Example2.Monster.pack(builder, _o.asMyGame_Example2_Monster());
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
public enum AnyUniqueAliases : byte
|
||||
{
|
||||
NONE = 0,
|
||||
M = 1,
|
||||
TS = 2,
|
||||
M2 = 3,
|
||||
};
|
||||
|
||||
public class AnyUniqueAliasesUnion {
|
||||
public AnyUniqueAliases Type { get; set; }
|
||||
public object Value { get; set; }
|
||||
|
||||
public AnyUniqueAliasesUnion() {
|
||||
this.Type = AnyUniqueAliases.NONE;
|
||||
this.Value = null;
|
||||
}
|
||||
|
||||
public T As<T>() where T : class { return this.Value as T; }
|
||||
public MyGame.Example.MonsterT AsM() { return this.As<MyGame.Example.MonsterT>(); }
|
||||
public static AnyUniqueAliasesUnion FromM(MyGame.Example.MonsterT _m) { return new AnyUniqueAliasesUnion{ Type = AnyUniqueAliases.M, Value = _m }; }
|
||||
internal MyGame.Example.TestSimpleTableWithEnumT AsTS() { return this.As<MyGame.Example.TestSimpleTableWithEnumT>(); }
|
||||
internal static AnyUniqueAliasesUnion FromTS(MyGame.Example.TestSimpleTableWithEnumT _ts) { return new AnyUniqueAliasesUnion{ Type = AnyUniqueAliases.TS, Value = _ts }; }
|
||||
public MyGame.Example2.MonsterT AsM2() { return this.As<MyGame.Example2.MonsterT>(); }
|
||||
public static AnyUniqueAliasesUnion FromM2(MyGame.Example2.MonsterT _m2) { return new AnyUniqueAliasesUnion{ Type = AnyUniqueAliases.M2, Value = _m2 }; }
|
||||
|
||||
public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, AnyUniqueAliasesUnion _o) {
|
||||
switch (_o.Type) {
|
||||
default: return 0;
|
||||
case AnyUniqueAliases.M: return MyGame.Example.Monster.Pack(builder, _o.AsM()).Value;
|
||||
case AnyUniqueAliases.TS: return MyGame.Example.TestSimpleTableWithEnum.Pack(builder, _o.AsTS()).Value;
|
||||
case AnyUniqueAliases.M2: return MyGame.Example2.Monster.Pack(builder, _o.AsM2()).Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class AnyUniqueAliasesUnion_JsonConverter : Newtonsoft.Json.JsonConverter {
|
||||
public override bool CanConvert(System.Type objectType) {
|
||||
return objectType == typeof(AnyUniqueAliasesUnion) || objectType == typeof(System.Collections.Generic.List<AnyUniqueAliasesUnion>);
|
||||
}
|
||||
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
var _olist = value as System.Collections.Generic.List<AnyUniqueAliasesUnion>;
|
||||
if (_olist != null) {
|
||||
writer.WriteStartArray();
|
||||
foreach (var _o in _olist) { this.WriteJson(writer, _o, serializer); }
|
||||
writer.WriteEndArray();
|
||||
} else {
|
||||
this.WriteJson(writer, value as AnyUniqueAliasesUnion, serializer);
|
||||
}
|
||||
}
|
||||
public void WriteJson(Newtonsoft.Json.JsonWriter writer, AnyUniqueAliasesUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
if (_o == null) return;
|
||||
serializer.Serialize(writer, _o.Value);
|
||||
}
|
||||
public override object ReadJson(Newtonsoft.Json.JsonReader reader, System.Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
var _olist = existingValue as System.Collections.Generic.List<AnyUniqueAliasesUnion>;
|
||||
if (_olist != null) {
|
||||
for (var _j = 0; _j < _olist.Count; ++_j) {
|
||||
reader.Read();
|
||||
_olist[_j] = this.ReadJson(reader, _olist[_j], serializer);
|
||||
}
|
||||
reader.Read();
|
||||
return _olist;
|
||||
} else {
|
||||
return this.ReadJson(reader, existingValue as AnyUniqueAliasesUnion, serializer);
|
||||
}
|
||||
}
|
||||
public AnyUniqueAliasesUnion ReadJson(Newtonsoft.Json.JsonReader reader, AnyUniqueAliasesUnion _o, Newtonsoft.Json.JsonSerializer serializer) {
|
||||
if (_o == null) return null;
|
||||
switch (_o.Type) {
|
||||
default: break;
|
||||
case AnyUniqueAliases.M: _o.Value = serializer.Deserialize<MyGame.Example.MonsterT>(reader); break;
|
||||
case AnyUniqueAliases.TS: _o.Value = serializer.Deserialize<MyGame.Example.TestSimpleTableWithEnumT>(reader); break;
|
||||
case AnyUniqueAliases.M2: _o.Value = serializer.Deserialize<MyGame.Example2.MonsterT>(reader); break;
|
||||
}
|
||||
return _o;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static public class AnyUniqueAliasesVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
|
||||
{
|
||||
bool result = true;
|
||||
switch((AnyUniqueAliases)typeId)
|
||||
{
|
||||
case AnyUniqueAliases.M:
|
||||
result = MyGame.Example.MonsterVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
case AnyUniqueAliases.TS:
|
||||
result = MyGame.Example.TestSimpleTableWithEnumVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
case AnyUniqueAliases.M2:
|
||||
result = MyGame.Example2.MonsterVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
default: result = true;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package Example
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
"strconv"
|
||||
|
||||
MyGame__Example2 "MyGame/Example2"
|
||||
)
|
||||
|
||||
type AnyUniqueAliases byte
|
||||
|
||||
const (
|
||||
AnyUniqueAliasesNONE AnyUniqueAliases = 0
|
||||
AnyUniqueAliasesM AnyUniqueAliases = 1
|
||||
AnyUniqueAliasesTS AnyUniqueAliases = 2
|
||||
AnyUniqueAliasesM2 AnyUniqueAliases = 3
|
||||
)
|
||||
|
||||
var EnumNamesAnyUniqueAliases = map[AnyUniqueAliases]string{
|
||||
AnyUniqueAliasesNONE: "NONE",
|
||||
AnyUniqueAliasesM: "M",
|
||||
AnyUniqueAliasesTS: "TS",
|
||||
AnyUniqueAliasesM2: "M2",
|
||||
}
|
||||
|
||||
var EnumValuesAnyUniqueAliases = map[string]AnyUniqueAliases{
|
||||
"NONE": AnyUniqueAliasesNONE,
|
||||
"M": AnyUniqueAliasesM,
|
||||
"TS": AnyUniqueAliasesTS,
|
||||
"M2": AnyUniqueAliasesM2,
|
||||
}
|
||||
|
||||
func (v AnyUniqueAliases) String() string {
|
||||
if s, ok := EnumNamesAnyUniqueAliases[v]; ok {
|
||||
return s
|
||||
}
|
||||
return "AnyUniqueAliases(" + strconv.FormatInt(int64(v), 10) + ")"
|
||||
}
|
||||
|
||||
type AnyUniqueAliasesT struct {
|
||||
Type AnyUniqueAliases
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
func (t *AnyUniqueAliasesT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil {
|
||||
return 0
|
||||
}
|
||||
switch t.Type {
|
||||
case AnyUniqueAliasesM:
|
||||
return t.Value.(*MonsterT).Pack(builder)
|
||||
case AnyUniqueAliasesTS:
|
||||
return t.Value.(*TestSimpleTableWithEnumT).Pack(builder)
|
||||
case AnyUniqueAliasesM2:
|
||||
return t.Value.(*MyGame__Example2.MonsterT).Pack(builder)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv AnyUniqueAliases) UnPack(table flatbuffers.Table) *AnyUniqueAliasesT {
|
||||
switch rcv {
|
||||
case AnyUniqueAliasesM:
|
||||
var x Monster
|
||||
x.Init(table.Bytes, table.Pos)
|
||||
return &AnyUniqueAliasesT{Type: AnyUniqueAliasesM, Value: x.UnPack()}
|
||||
case AnyUniqueAliasesTS:
|
||||
var x TestSimpleTableWithEnum
|
||||
x.Init(table.Bytes, table.Pos)
|
||||
return &AnyUniqueAliasesT{Type: AnyUniqueAliasesTS, Value: x.UnPack()}
|
||||
case AnyUniqueAliasesM2:
|
||||
var x MyGame__Example2.Monster
|
||||
x.Init(table.Bytes, table.Pos)
|
||||
return &AnyUniqueAliasesT{Type: AnyUniqueAliasesM2, Value: x.UnPack()}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class AnyUniqueAliases {
|
||||
private AnyUniqueAliases() { }
|
||||
public static final byte NONE = 0;
|
||||
public static final byte M = 1;
|
||||
public static final byte TS = 2;
|
||||
public static final byte M2 = 3;
|
||||
|
||||
public static final String[] names = { "NONE", "M", "TS", "M2", };
|
||||
|
||||
public static String name(int e) { return names[e]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example
|
||||
|
||||
@Suppress("unused")
|
||||
class AnyUniqueAliases private constructor() {
|
||||
companion object {
|
||||
const val NONE: UByte = 0u
|
||||
const val M: UByte = 1u
|
||||
const val TS: UByte = 2u
|
||||
const val M2: UByte = 3u
|
||||
val names : Array<String> = arrayOf("NONE", "M", "TS", "M2")
|
||||
fun name(e: Int) : String = names[e]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--[[ MyGame.Example.AnyUniqueAliases
|
||||
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by : //monster_test.fbs
|
||||
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
|
||||
|
||||
--]]
|
||||
|
||||
local AnyUniqueAliases = {
|
||||
NONE = 0,
|
||||
M = 1,
|
||||
TS = 2,
|
||||
M2 = 3,
|
||||
}
|
||||
|
||||
return AnyUniqueAliases
|
||||
@@ -0,0 +1,15 @@
|
||||
#[ MyGame.Example.AnyUniqueAliases
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by :
|
||||
Rooting type : MyGame.Example.Monster ()
|
||||
]#
|
||||
|
||||
type AnyUniqueAliases*{.pure.} = enum
|
||||
None = 0.uint8,
|
||||
M = 1.uint8,
|
||||
Ts = 2.uint8,
|
||||
M2 = 3.uint8,
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace MyGame\Example;
|
||||
|
||||
class AnyUniqueAliases
|
||||
{
|
||||
const NONE = 0;
|
||||
const M = 1;
|
||||
const TS = 2;
|
||||
const M2 = 3;
|
||||
|
||||
private static $names = array(
|
||||
AnyUniqueAliases::NONE=>"NONE",
|
||||
AnyUniqueAliases::M=>"M",
|
||||
AnyUniqueAliases::TS=>"TS",
|
||||
AnyUniqueAliases::M2=>"M2",
|
||||
);
|
||||
|
||||
public static function Name($e)
|
||||
{
|
||||
if (!isset(self::$names[$e])) {
|
||||
throw new \Exception();
|
||||
}
|
||||
return self::$names[$e];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
class AnyUniqueAliases(object):
|
||||
NONE = 0
|
||||
M = 1
|
||||
TS = 2
|
||||
M2 = 3
|
||||
|
||||
def AnyUniqueAliasesCreator(unionType, table):
|
||||
from flatbuffers.table import Table
|
||||
if not isinstance(table, Table):
|
||||
return None
|
||||
if unionType == AnyUniqueAliases().M:
|
||||
import MyGame.Example.Monster
|
||||
return MyGame.Example.Monster.MonsterT.InitFromBuf(table.Bytes, table.Pos)
|
||||
if unionType == AnyUniqueAliases().TS:
|
||||
import MyGame.Example.TestSimpleTableWithEnum
|
||||
return MyGame.Example.TestSimpleTableWithEnum.TestSimpleTableWithEnumT.InitFromBuf(table.Bytes, table.Pos)
|
||||
if unionType == AnyUniqueAliases().M2:
|
||||
import MyGame.Example2.Monster
|
||||
return MyGame.Example2.Monster.MonsterT.InitFromBuf(table.Bytes, table.Pos)
|
||||
return None
|
||||
@@ -0,0 +1,37 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
|
||||
public class AnyUniqueAliasesUnion {
|
||||
private byte type;
|
||||
private Object value;
|
||||
|
||||
public byte getType() { return type; }
|
||||
|
||||
public void setType(byte type) { this.type = type; }
|
||||
|
||||
public Object getValue() { return value; }
|
||||
|
||||
public void setValue(Object value) { this.value = value; }
|
||||
|
||||
public AnyUniqueAliasesUnion() {
|
||||
this.type = AnyUniqueAliases.NONE;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public MyGame.Example.MonsterT asM() { return (MyGame.Example.MonsterT) value; }
|
||||
MyGame.Example.TestSimpleTableWithEnumT asTS() { return (MyGame.Example.TestSimpleTableWithEnumT) value; }
|
||||
public MyGame.Example2.MonsterT asM2() { return (MyGame.Example2.MonsterT) value; }
|
||||
|
||||
public static int pack(FlatBufferBuilder builder, AnyUniqueAliasesUnion _o) {
|
||||
switch (_o.type) {
|
||||
case AnyUniqueAliases.M: return MyGame.Example.Monster.pack(builder, _o.asM());
|
||||
case AnyUniqueAliases.TS: return MyGame.Example.TestSimpleTableWithEnum.pack(builder, _o.asTS());
|
||||
case AnyUniqueAliases.M2: return MyGame.Example2.Monster.pack(builder, _o.asM2());
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct ArrayStruct : IFlatbufferObject
|
||||
{
|
||||
private Struct __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Struct(_i, _bb); }
|
||||
public ArrayStruct __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public float A { get { return __p.bb.GetFloat(__p.bb_pos + 0); } }
|
||||
public void MutateA(float a) { __p.bb.PutFloat(__p.bb_pos + 0, a); }
|
||||
public int B(int j) { return __p.bb.GetInt(__p.bb_pos + 4 + j * 4); }
|
||||
public void MutateB(int j, int b) { __p.bb.PutInt(__p.bb_pos + 4 + j * 4, b); }
|
||||
public sbyte C { get { return __p.bb.GetSbyte(__p.bb_pos + 64); } }
|
||||
public void MutateC(sbyte c) { __p.bb.PutSbyte(__p.bb_pos + 64, c); }
|
||||
public MyGame.Example.NestedStruct D(int j) { return (new MyGame.Example.NestedStruct()).__assign(__p.bb_pos + 72 + j * 32, __p.bb); }
|
||||
public int E { get { return __p.bb.GetInt(__p.bb_pos + 136); } }
|
||||
public void MutateE(int e) { __p.bb.PutInt(__p.bb_pos + 136, e); }
|
||||
public long F(int j) { return __p.bb.GetLong(__p.bb_pos + 144 + j * 8); }
|
||||
public void MutateF(int j, long f) { __p.bb.PutLong(__p.bb_pos + 144 + j * 8, f); }
|
||||
|
||||
public static Offset<MyGame.Example.ArrayStruct> CreateArrayStruct(FlatBufferBuilder builder, float A, int[] B, sbyte C, int[,] d_A, MyGame.Example.TestEnum[] d_B, MyGame.Example.TestEnum[,] d_C, long[,] d_D, int E, long[] F) {
|
||||
builder.Prep(8, 160);
|
||||
for (int _idx0 = 2; _idx0 > 0; _idx0--) {
|
||||
builder.PutLong(F[_idx0-1]);
|
||||
}
|
||||
builder.Pad(4);
|
||||
builder.PutInt(E);
|
||||
for (int _idx0 = 2; _idx0 > 0; _idx0--) {
|
||||
builder.Prep(8, 32);
|
||||
for (int _idx1 = 2; _idx1 > 0; _idx1--) {
|
||||
builder.PutLong(d_D[_idx0-1,_idx1-1]);
|
||||
}
|
||||
builder.Pad(5);
|
||||
for (int _idx1 = 2; _idx1 > 0; _idx1--) {
|
||||
builder.PutSbyte((sbyte)d_C[_idx0-1,_idx1-1]);
|
||||
}
|
||||
builder.PutSbyte((sbyte)d_B[_idx0-1]);
|
||||
for (int _idx1 = 2; _idx1 > 0; _idx1--) {
|
||||
builder.PutInt(d_A[_idx0-1,_idx1-1]);
|
||||
}
|
||||
}
|
||||
builder.Pad(7);
|
||||
builder.PutSbyte(C);
|
||||
for (int _idx0 = 15; _idx0 > 0; _idx0--) {
|
||||
builder.PutInt(B[_idx0-1]);
|
||||
}
|
||||
builder.PutFloat(A);
|
||||
return new Offset<MyGame.Example.ArrayStruct>(builder.Offset);
|
||||
}
|
||||
public ArrayStructT UnPack() {
|
||||
var _o = new ArrayStructT();
|
||||
this.UnPackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void UnPackTo(ArrayStructT _o) {
|
||||
_o.A = this.A;
|
||||
_o.B = new int[15];
|
||||
for (var _j = 0; _j < 15; ++_j) { _o.B[_j] = this.B(_j); }
|
||||
_o.C = this.C;
|
||||
_o.D = new MyGame.Example.NestedStructT[2];
|
||||
for (var _j = 0; _j < 2; ++_j) { _o.D[_j] = this.D(_j).UnPack(); }
|
||||
_o.E = this.E;
|
||||
_o.F = new long[2];
|
||||
for (var _j = 0; _j < 2; ++_j) { _o.F[_j] = this.F(_j); }
|
||||
}
|
||||
public static Offset<MyGame.Example.ArrayStruct> Pack(FlatBufferBuilder builder, ArrayStructT _o) {
|
||||
if (_o == null) return default(Offset<MyGame.Example.ArrayStruct>);
|
||||
var _b = _o.B;
|
||||
var _d_a = new int[2,2];
|
||||
for (var idx0 = 0; idx0 < 2; ++idx0) {for (var idx1 = 0; idx1 < 2; ++idx1) {_d_a[idx0,idx1] = _o.D[idx0].A[idx1];}}
|
||||
var _d_b = new MyGame.Example.TestEnum[2];
|
||||
for (var idx0 = 0; idx0 < 2; ++idx0) {_d_b[idx0] = _o.D[idx0].B;}
|
||||
var _d_c = new MyGame.Example.TestEnum[2,2];
|
||||
for (var idx0 = 0; idx0 < 2; ++idx0) {for (var idx1 = 0; idx1 < 2; ++idx1) {_d_c[idx0,idx1] = _o.D[idx0].C[idx1];}}
|
||||
var _d_d = new long[2,2];
|
||||
for (var idx0 = 0; idx0 < 2; ++idx0) {for (var idx1 = 0; idx1 < 2; ++idx1) {_d_d[idx0,idx1] = _o.D[idx0].D[idx1];}}
|
||||
var _f = _o.F;
|
||||
return CreateArrayStruct(
|
||||
builder,
|
||||
_o.A,
|
||||
_b,
|
||||
_o.C,
|
||||
_d_a,
|
||||
_d_b,
|
||||
_d_c,
|
||||
_d_d,
|
||||
_o.E,
|
||||
_f);
|
||||
}
|
||||
}
|
||||
|
||||
public class ArrayStructT
|
||||
{
|
||||
[Newtonsoft.Json.JsonProperty("a")]
|
||||
public float A { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("b")]
|
||||
public int[] B { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("c")]
|
||||
public sbyte C { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("d")]
|
||||
public MyGame.Example.NestedStructT[] D { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("e")]
|
||||
public int E { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("f")]
|
||||
public long[] F { get; set; }
|
||||
|
||||
public ArrayStructT() {
|
||||
this.A = 0.0f;
|
||||
this.B = new int[15];
|
||||
this.C = 0;
|
||||
this.D = new MyGame.Example.NestedStructT[2];
|
||||
this.E = 0;
|
||||
this.F = new long[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class ArrayStruct extends Struct {
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public ArrayStruct __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public float a() { return bb.getFloat(bb_pos + 0); }
|
||||
public void mutateA(float a) { bb.putFloat(bb_pos + 0, a); }
|
||||
public int b(int j) { return bb.getInt(bb_pos + 4 + j * 4); }
|
||||
public void mutateB(int j, int b) { bb.putInt(bb_pos + 4 + j * 4, b); }
|
||||
public byte c() { return bb.get(bb_pos + 64); }
|
||||
public void mutateC(byte c) { bb.put(bb_pos + 64, c); }
|
||||
public MyGame.Example.NestedStruct d(int j) { return d(new MyGame.Example.NestedStruct(), j); }
|
||||
public MyGame.Example.NestedStruct d(MyGame.Example.NestedStruct obj, int j) { return obj.__assign(bb_pos + 72 + j * 32, bb); }
|
||||
public int e() { return bb.getInt(bb_pos + 136); }
|
||||
public void mutateE(int e) { bb.putInt(bb_pos + 136, e); }
|
||||
public long f(int j) { return bb.getLong(bb_pos + 144 + j * 8); }
|
||||
public void mutateF(int j, long f) { bb.putLong(bb_pos + 144 + j * 8, f); }
|
||||
|
||||
public static int createArrayStruct(FlatBufferBuilder builder, float a, int[] b, byte c, int[][] d_a, byte[] d_b, byte[][] d_c, long[][] d_d, int e, long[] f) {
|
||||
builder.prep(8, 160);
|
||||
for (int _idx0 = 2; _idx0 > 0; _idx0--) {
|
||||
builder.putLong(f[_idx0-1]);
|
||||
}
|
||||
builder.pad(4);
|
||||
builder.putInt(e);
|
||||
for (int _idx0 = 2; _idx0 > 0; _idx0--) {
|
||||
builder.prep(8, 32);
|
||||
for (int _idx1 = 2; _idx1 > 0; _idx1--) {
|
||||
builder.putLong(d_d[_idx0-1][_idx1-1]);
|
||||
}
|
||||
builder.pad(5);
|
||||
for (int _idx1 = 2; _idx1 > 0; _idx1--) {
|
||||
builder.putByte(d_c[_idx0-1][_idx1-1]);
|
||||
}
|
||||
builder.putByte(d_b[_idx0-1]);
|
||||
for (int _idx1 = 2; _idx1 > 0; _idx1--) {
|
||||
builder.putInt(d_a[_idx0-1][_idx1-1]);
|
||||
}
|
||||
}
|
||||
builder.pad(7);
|
||||
builder.putByte(c);
|
||||
for (int _idx0 = 15; _idx0 > 0; _idx0--) {
|
||||
builder.putInt(b[_idx0-1]);
|
||||
}
|
||||
builder.putFloat(a);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public ArrayStruct get(int j) { return get(new ArrayStruct(), j); }
|
||||
public ArrayStruct get(ArrayStruct obj, int j) { return obj.__assign(__element(j), bb); }
|
||||
}
|
||||
public ArrayStructT unpack() {
|
||||
ArrayStructT _o = new ArrayStructT();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(ArrayStructT _o) {
|
||||
float _oA = a();
|
||||
_o.setA(_oA);
|
||||
int[] _oB = _o.getB();
|
||||
for (int _j = 0; _j < 15; ++_j) { _oB[_j] = b(_j); }
|
||||
byte _oC = c();
|
||||
_o.setC(_oC);
|
||||
MyGame.Example.NestedStructT[] _oD = _o.getD();
|
||||
for (int _j = 0; _j < 2; ++_j) { _oD[_j] = d(_j).unpack(); }
|
||||
int _oE = e();
|
||||
_o.setE(_oE);
|
||||
long[] _oF = _o.getF();
|
||||
for (int _j = 0; _j < 2; ++_j) { _oF[_j] = f(_j); }
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, ArrayStructT _o) {
|
||||
if (_o == null) return 0;
|
||||
int[] _b = _o.getB();
|
||||
int[][] _d_a = new int[2][2];
|
||||
for (int idx0 = 0; idx0 < 2; ++idx0) {for (int idx1 = 0; idx1 < 2; ++idx1) {_d_a[idx0][idx1] = _o.getD()[idx0].getA()[idx1];}}
|
||||
byte[] _d_b = new byte[2];
|
||||
for (int idx0 = 0; idx0 < 2; ++idx0) {_d_b[idx0] = _o.getD()[idx0].getB();}
|
||||
byte[][] _d_c = new byte[2][2];
|
||||
for (int idx0 = 0; idx0 < 2; ++idx0) {for (int idx1 = 0; idx1 < 2; ++idx1) {_d_c[idx0][idx1] = _o.getD()[idx0].getC()[idx1];}}
|
||||
long[][] _d_d = new long[2][2];
|
||||
for (int idx0 = 0; idx0 < 2; ++idx0) {for (int idx1 = 0; idx1 < 2; ++idx1) {_d_d[idx0][idx1] = _o.getD()[idx0].getD()[idx1];}}
|
||||
long[] _f = _o.getF();
|
||||
return createArrayStruct(
|
||||
builder,
|
||||
_o.getA(),
|
||||
_b,
|
||||
_o.getC(),
|
||||
_d_a,
|
||||
_d_b,
|
||||
_d_c,
|
||||
_d_d,
|
||||
_o.getE(),
|
||||
_f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
from typing import Any
|
||||
from MyGame.Example.NestedStruct import NestedStruct
|
||||
np = import_numpy()
|
||||
|
||||
class ArrayStruct(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def SizeOf(cls) -> int:
|
||||
return 160
|
||||
|
||||
# ArrayStruct
|
||||
def Init(self, buf: bytes, pos: int):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# ArrayStruct
|
||||
def A(self): return self._tab.Get(flatbuffers.number_types.Float32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0))
|
||||
# ArrayStruct
|
||||
def B(self, j = None):
|
||||
if j is None:
|
||||
return [self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(4 + i * 4)) for i in range(self.BLength())]
|
||||
elif j >= 0 and j < self.BLength():
|
||||
return self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(4 + j * 4))
|
||||
else:
|
||||
return None
|
||||
|
||||
# ArrayStruct
|
||||
def BAsNumpy(self):
|
||||
return self._tab.GetArrayAsNumpy(flatbuffers.number_types.Int32Flags, self._tab.Pos + 4, self.BLength())
|
||||
|
||||
# ArrayStruct
|
||||
def BLength(self) -> int:
|
||||
return 15
|
||||
|
||||
# ArrayStruct
|
||||
def BIsNone(self) -> bool:
|
||||
return False
|
||||
|
||||
# ArrayStruct
|
||||
def C(self): return self._tab.Get(flatbuffers.number_types.Int8Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(64))
|
||||
# ArrayStruct
|
||||
def D(self, i: int) -> NestedStruct:
|
||||
obj = NestedStruct()
|
||||
obj.Init(self._tab.Bytes, self._tab.Pos + 72 + i * 32)
|
||||
return obj
|
||||
|
||||
# ArrayStruct
|
||||
def DLength(self) -> int:
|
||||
return 2
|
||||
|
||||
# ArrayStruct
|
||||
def DIsNone(self) -> bool:
|
||||
return False
|
||||
|
||||
# ArrayStruct
|
||||
def E(self): return self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(136))
|
||||
# ArrayStruct
|
||||
def F(self, j = None):
|
||||
if j is None:
|
||||
return [self._tab.Get(flatbuffers.number_types.Int64Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(144 + i * 8)) for i in range(self.FLength())]
|
||||
elif j >= 0 and j < self.FLength():
|
||||
return self._tab.Get(flatbuffers.number_types.Int64Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(144 + j * 8))
|
||||
else:
|
||||
return None
|
||||
|
||||
# ArrayStruct
|
||||
def FAsNumpy(self):
|
||||
return self._tab.GetArrayAsNumpy(flatbuffers.number_types.Int64Flags, self._tab.Pos + 144, self.FLength())
|
||||
|
||||
# ArrayStruct
|
||||
def FLength(self) -> int:
|
||||
return 2
|
||||
|
||||
# ArrayStruct
|
||||
def FIsNone(self) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def CreateArrayStruct(builder, a, b, c, d_a, d_b, d_c, d_d, e, f):
|
||||
builder.Prep(8, 160)
|
||||
for _idx0 in range(2 , 0, -1):
|
||||
builder.PrependInt64(f[_idx0-1])
|
||||
builder.Pad(4)
|
||||
builder.PrependInt32(e)
|
||||
for _idx0 in range(2 , 0, -1):
|
||||
builder.Prep(8, 32)
|
||||
for _idx1 in range(2 , 0, -1):
|
||||
builder.PrependInt64(d_d[_idx0-1][_idx1-1])
|
||||
builder.Pad(5)
|
||||
for _idx1 in range(2 , 0, -1):
|
||||
builder.PrependInt8(d_c[_idx0-1][_idx1-1])
|
||||
builder.PrependInt8(d_b[_idx0-1])
|
||||
for _idx1 in range(2 , 0, -1):
|
||||
builder.PrependInt32(d_a[_idx0-1][_idx1-1])
|
||||
builder.Pad(7)
|
||||
builder.PrependInt8(c)
|
||||
for _idx0 in range(15 , 0, -1):
|
||||
builder.PrependInt32(b[_idx0-1])
|
||||
builder.PrependFloat32(a)
|
||||
return builder.Offset()
|
||||
|
||||
import MyGame.Example.NestedStruct
|
||||
try:
|
||||
from typing import List
|
||||
except:
|
||||
pass
|
||||
|
||||
class ArrayStructT(object):
|
||||
|
||||
# ArrayStructT
|
||||
def __init__(self):
|
||||
self.a = 0.0 # type: float
|
||||
self.b = None # type: List[int]
|
||||
self.c = 0 # type: int
|
||||
self.d = None # type: List[MyGame.Example.NestedStruct.NestedStructT]
|
||||
self.e = 0 # type: int
|
||||
self.f = None # type: List[int]
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
arrayStruct = ArrayStruct()
|
||||
arrayStruct.Init(buf, pos)
|
||||
return cls.InitFromObj(arrayStruct)
|
||||
|
||||
@classmethod
|
||||
def InitFromPackedBuf(cls, buf, pos=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
||||
return cls.InitFromBuf(buf, pos+n)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, arrayStruct):
|
||||
x = ArrayStructT()
|
||||
x._UnPack(arrayStruct)
|
||||
return x
|
||||
|
||||
# ArrayStructT
|
||||
def _UnPack(self, arrayStruct):
|
||||
if arrayStruct is None:
|
||||
return
|
||||
self.a = arrayStruct.A()
|
||||
if not arrayStruct.BIsNone():
|
||||
if np is None:
|
||||
self.b = []
|
||||
for i in range(arrayStruct.BLength()):
|
||||
self.b.append(arrayStruct.B(i))
|
||||
else:
|
||||
self.b = arrayStruct.BAsNumpy()
|
||||
self.c = arrayStruct.C()
|
||||
if not arrayStruct.DIsNone():
|
||||
self.d = []
|
||||
for i in range(arrayStruct.DLength()):
|
||||
if arrayStruct.D(i) is None:
|
||||
self.d.append(None)
|
||||
else:
|
||||
nestedStruct_ = MyGame.Example.NestedStruct.NestedStructT.InitFromObj(arrayStruct.D(i))
|
||||
self.d.append(nestedStruct_)
|
||||
self.e = arrayStruct.E()
|
||||
if not arrayStruct.FIsNone():
|
||||
if np is None:
|
||||
self.f = []
|
||||
for i in range(arrayStruct.FLength()):
|
||||
self.f.append(arrayStruct.F(i))
|
||||
else:
|
||||
self.f = arrayStruct.FAsNumpy()
|
||||
|
||||
# ArrayStructT
|
||||
def Pack(self, builder):
|
||||
return CreateArrayStruct(builder, self.a, self.b, self.c, self.d.a, self.d.b, self.d.c, self.d.d, self.e, self.f)
|
||||
@@ -0,0 +1,64 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
public class ArrayStructT {
|
||||
private float a;
|
||||
private int[] b;
|
||||
private byte c;
|
||||
private MyGame.Example.NestedStructT[] d;
|
||||
private int e;
|
||||
private long[] f;
|
||||
|
||||
public float getA() { return a; }
|
||||
|
||||
public void setA(float a) { this.a = a; }
|
||||
|
||||
public int[] getB() { return b; }
|
||||
|
||||
public void setB(int[] b) { if (b != null && b.length == 15) this.b = b; }
|
||||
|
||||
public byte getC() { return c; }
|
||||
|
||||
public void setC(byte c) { this.c = c; }
|
||||
|
||||
public MyGame.Example.NestedStructT[] getD() { return d; }
|
||||
|
||||
public void setD(MyGame.Example.NestedStructT[] d) { if (d != null && d.length == 2) this.d = d; }
|
||||
|
||||
public int getE() { return e; }
|
||||
|
||||
public void setE(int e) { this.e = e; }
|
||||
|
||||
public long[] getF() { return f; }
|
||||
|
||||
public void setF(long[] f) { if (f != null && f.length == 2) this.f = f; }
|
||||
|
||||
|
||||
public ArrayStructT() {
|
||||
this.a = 0.0f;
|
||||
this.b = new int[15];
|
||||
this.c = 0;
|
||||
this.d = new MyGame.Example.NestedStructT[2];
|
||||
this.e = 0;
|
||||
this.f = new long[2];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct ArrayTable : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_24_3_25(); }
|
||||
public static ArrayTable GetRootAsArrayTable(ByteBuffer _bb) { return GetRootAsArrayTable(_bb, new ArrayTable()); }
|
||||
public static ArrayTable GetRootAsArrayTable(ByteBuffer _bb, ArrayTable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public static bool ArrayTableBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "ARRT"); }
|
||||
public static bool VerifyArrayTable(ByteBuffer _bb) {Google.FlatBuffers.Verifier verifier = new Google.FlatBuffers.Verifier(_bb); return verifier.VerifyBuffer("ARRT", false, ArrayTableVerify.Verify); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||
public ArrayTable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public MyGame.Example.ArrayStruct? A { get { int o = __p.__offset(4); return o != 0 ? (MyGame.Example.ArrayStruct?)(new MyGame.Example.ArrayStruct()).__assign(o + __p.bb_pos, __p.bb) : null; } }
|
||||
|
||||
public static void StartArrayTable(FlatBufferBuilder builder) { builder.StartTable(1); }
|
||||
public static void AddA(FlatBufferBuilder builder, Offset<MyGame.Example.ArrayStruct> aOffset) { builder.AddStruct(0, aOffset.Value, 0); }
|
||||
public static Offset<MyGame.Example.ArrayTable> EndArrayTable(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<MyGame.Example.ArrayTable>(o);
|
||||
}
|
||||
public static void FinishArrayTableBuffer(FlatBufferBuilder builder, Offset<MyGame.Example.ArrayTable> offset) { builder.Finish(offset.Value, "ARRT"); }
|
||||
public static void FinishSizePrefixedArrayTableBuffer(FlatBufferBuilder builder, Offset<MyGame.Example.ArrayTable> offset) { builder.FinishSizePrefixed(offset.Value, "ARRT"); }
|
||||
public ArrayTableT UnPack() {
|
||||
var _o = new ArrayTableT();
|
||||
this.UnPackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void UnPackTo(ArrayTableT _o) {
|
||||
_o.A = this.A.HasValue ? this.A.Value.UnPack() : null;
|
||||
}
|
||||
public static Offset<MyGame.Example.ArrayTable> Pack(FlatBufferBuilder builder, ArrayTableT _o) {
|
||||
if (_o == null) return default(Offset<MyGame.Example.ArrayTable>);
|
||||
StartArrayTable(builder);
|
||||
AddA(builder, MyGame.Example.ArrayStruct.Pack(builder, _o.A));
|
||||
return EndArrayTable(builder);
|
||||
}
|
||||
}
|
||||
|
||||
public class ArrayTableT
|
||||
{
|
||||
[Newtonsoft.Json.JsonProperty("a")]
|
||||
public MyGame.Example.ArrayStructT A { get; set; }
|
||||
|
||||
public ArrayTableT() {
|
||||
this.A = new MyGame.Example.ArrayStructT();
|
||||
}
|
||||
|
||||
public static ArrayTableT DeserializeFromJson(string jsonText) {
|
||||
return Newtonsoft.Json.JsonConvert.DeserializeObject<ArrayTableT>(jsonText);
|
||||
}
|
||||
public string SerializeToJson() {
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
|
||||
}
|
||||
public static ArrayTableT DeserializeFromBinary(byte[] fbBuffer) {
|
||||
return ArrayTable.GetRootAsArrayTable(new ByteBuffer(fbBuffer)).UnPack();
|
||||
}
|
||||
public byte[] SerializeToBinary() {
|
||||
var fbb = new FlatBufferBuilder(0x10000);
|
||||
ArrayTable.FinishArrayTableBuffer(fbb, ArrayTable.Pack(fbb, this));
|
||||
return fbb.DataBuffer.ToSizedArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public class ArrayTableVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
|
||||
{
|
||||
return verifier.VerifyTableStart(tablePos)
|
||||
&& verifier.VerifyField(tablePos, 4 /*A*/, 160 /*MyGame.Example.ArrayStruct*/, 8, false)
|
||||
&& verifier.VerifyTableEnd(tablePos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class ArrayTable extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_24_3_25(); }
|
||||
public static ArrayTable getRootAsArrayTable(ByteBuffer _bb) { return getRootAsArrayTable(_bb, new ArrayTable()); }
|
||||
public static ArrayTable getRootAsArrayTable(ByteBuffer _bb, ArrayTable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public static boolean ArrayTableBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "ARRT"); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public ArrayTable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public MyGame.Example.ArrayStruct a() { return a(new MyGame.Example.ArrayStruct()); }
|
||||
public MyGame.Example.ArrayStruct a(MyGame.Example.ArrayStruct obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
|
||||
|
||||
public static void startArrayTable(FlatBufferBuilder builder) { builder.startTable(1); }
|
||||
public static void addA(FlatBufferBuilder builder, int aOffset) { builder.addStruct(0, aOffset, 0); }
|
||||
public static int endArrayTable(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
public static void finishArrayTableBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset, "ARRT"); }
|
||||
public static void finishSizePrefixedArrayTableBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset, "ARRT"); }
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public ArrayTable get(int j) { return get(new ArrayTable(), j); }
|
||||
public ArrayTable get(ArrayTable obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
}
|
||||
public ArrayTableT unpack() {
|
||||
ArrayTableT _o = new ArrayTableT();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(ArrayTableT _o) {
|
||||
if (a() != null) a().unpackTo(_o.getA());
|
||||
else _o.setA(null);
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, ArrayTableT _o) {
|
||||
if (_o == null) return 0;
|
||||
startArrayTable(builder);
|
||||
addA(builder, MyGame.Example.ArrayStruct.pack(builder, _o.getA()));
|
||||
return endArrayTable(builder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
from typing import Any
|
||||
from MyGame.Example.ArrayStruct import ArrayStruct
|
||||
from typing import Optional
|
||||
np = import_numpy()
|
||||
|
||||
class ArrayTable(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset: int = 0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = ArrayTable()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def GetRootAsArrayTable(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
@classmethod
|
||||
def ArrayTableBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
||||
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x41\x52\x52\x54", size_prefixed=size_prefixed)
|
||||
|
||||
# ArrayTable
|
||||
def Init(self, buf: bytes, pos: int):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# ArrayTable
|
||||
def A(self) -> Optional[ArrayStruct]:
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
||||
if o != 0:
|
||||
x = o + self._tab.Pos
|
||||
obj = ArrayStruct()
|
||||
obj.Init(self._tab.Bytes, x)
|
||||
return obj
|
||||
return None
|
||||
|
||||
def ArrayTableStart(builder: flatbuffers.Builder):
|
||||
builder.StartObject(1)
|
||||
|
||||
def Start(builder: flatbuffers.Builder):
|
||||
ArrayTableStart(builder)
|
||||
|
||||
def ArrayTableAddA(builder: flatbuffers.Builder, a: Any):
|
||||
builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(a), 0)
|
||||
|
||||
def AddA(builder: flatbuffers.Builder, a: Any):
|
||||
ArrayTableAddA(builder, a)
|
||||
|
||||
def ArrayTableEnd(builder: flatbuffers.Builder) -> int:
|
||||
return builder.EndObject()
|
||||
|
||||
def End(builder: flatbuffers.Builder) -> int:
|
||||
return ArrayTableEnd(builder)
|
||||
|
||||
import MyGame.Example.ArrayStruct
|
||||
try:
|
||||
from typing import Optional
|
||||
except:
|
||||
pass
|
||||
|
||||
class ArrayTableT(object):
|
||||
|
||||
# ArrayTableT
|
||||
def __init__(self):
|
||||
self.a = None # type: Optional[MyGame.Example.ArrayStruct.ArrayStructT]
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
arrayTable = ArrayTable()
|
||||
arrayTable.Init(buf, pos)
|
||||
return cls.InitFromObj(arrayTable)
|
||||
|
||||
@classmethod
|
||||
def InitFromPackedBuf(cls, buf, pos=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
||||
return cls.InitFromBuf(buf, pos+n)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, arrayTable):
|
||||
x = ArrayTableT()
|
||||
x._UnPack(arrayTable)
|
||||
return x
|
||||
|
||||
# ArrayTableT
|
||||
def _UnPack(self, arrayTable):
|
||||
if arrayTable is None:
|
||||
return
|
||||
if arrayTable.A() is not None:
|
||||
self.a = MyGame.Example.ArrayStruct.ArrayStructT.InitFromObj(arrayTable.A())
|
||||
|
||||
# ArrayTableT
|
||||
def Pack(self, builder):
|
||||
ArrayTableStart(builder)
|
||||
if self.a is not None:
|
||||
a = self.a.Pack(builder)
|
||||
ArrayTableAddA(builder, a)
|
||||
arrayTable = ArrayTableEnd(builder)
|
||||
return arrayTable
|
||||
@@ -0,0 +1,42 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
public class ArrayTableT {
|
||||
private MyGame.Example.ArrayStructT a;
|
||||
|
||||
public MyGame.Example.ArrayStructT getA() { return a; }
|
||||
|
||||
public void setA(MyGame.Example.ArrayStructT a) { this.a = a; }
|
||||
|
||||
|
||||
public ArrayTableT() {
|
||||
this.a = new MyGame.Example.ArrayStructT();
|
||||
}
|
||||
public static ArrayTableT deserializeFromBinary(byte[] fbBuffer) {
|
||||
return ArrayTable.getRootAsArrayTable(ByteBuffer.wrap(fbBuffer)).unpack();
|
||||
}
|
||||
public byte[] serializeToBinary() {
|
||||
FlatBufferBuilder fbb = new FlatBufferBuilder();
|
||||
ArrayTable.finishArrayTableBuffer(fbb, ArrayTable.pack(fbb, this));
|
||||
return fbb.sizedByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
/// Composite components of Monster color.
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
[System.FlagsAttribute]
|
||||
public enum Color : byte
|
||||
{
|
||||
Red = 1,
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
Green = 2,
|
||||
/// \brief color Blue (1u << 3)
|
||||
Blue = 8,
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package Example
|
||||
|
||||
import "strconv"
|
||||
|
||||
/// Composite components of Monster color.
|
||||
type Color byte
|
||||
|
||||
const (
|
||||
ColorRed Color = 1
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
ColorGreen Color = 2
|
||||
/// \brief color Blue (1u << 3)
|
||||
ColorBlue Color = 8
|
||||
)
|
||||
|
||||
var EnumNamesColor = map[Color]string{
|
||||
ColorRed: "Red",
|
||||
ColorGreen: "Green",
|
||||
ColorBlue: "Blue",
|
||||
}
|
||||
|
||||
var EnumValuesColor = map[string]Color{
|
||||
"Red": ColorRed,
|
||||
"Green": ColorGreen,
|
||||
"Blue": ColorBlue,
|
||||
}
|
||||
|
||||
func (v Color) String() string {
|
||||
if s, ok := EnumNamesColor[v]; ok {
|
||||
return s
|
||||
}
|
||||
return "Color(" + strconv.FormatInt(int64(v), 10) + ")"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
/**
|
||||
* Composite components of Monster color.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public final class Color {
|
||||
private Color() { }
|
||||
public static final int Red = 1;
|
||||
/**
|
||||
* \brief color Green
|
||||
* Green is bit_flag with value (1u << 1)
|
||||
*/
|
||||
public static final int Green = 2;
|
||||
/**
|
||||
* \brief color Blue (1u << 3)
|
||||
*/
|
||||
public static final int Blue = 8;
|
||||
|
||||
public static final String[] names = { "Red", "Green", "", "", "", "", "", "Blue", };
|
||||
|
||||
public static String name(int e) { return names[e - Red]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example
|
||||
|
||||
/**
|
||||
* Composite components of Monster color.
|
||||
*/
|
||||
@Suppress("unused")
|
||||
class Color private constructor() {
|
||||
companion object {
|
||||
const val Red: UByte = 1u
|
||||
/**
|
||||
* \brief color Green
|
||||
* Green is bit_flag with value (1u << 1)
|
||||
*/
|
||||
const val Green: UByte = 2u
|
||||
/**
|
||||
* \brief color Blue (1u << 3)
|
||||
*/
|
||||
const val Blue: UByte = 8u
|
||||
val names : Array<String> = arrayOf("Red", "Green", "", "", "", "", "", "Blue")
|
||||
fun name(e: Int) : String = names[e - Red.toInt()]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
--[[ MyGame.Example.Color
|
||||
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by : //monster_test.fbs
|
||||
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
|
||||
|
||||
--]]
|
||||
|
||||
-- Composite components of Monster color.
|
||||
local Color = {
|
||||
Red = 1,
|
||||
-- \brief color Green
|
||||
-- Green is bit_flag with value (1u << 1)
|
||||
Green = 2,
|
||||
-- \brief color Blue (1u << 3)
|
||||
Blue = 8,
|
||||
}
|
||||
|
||||
return Color
|
||||
@@ -0,0 +1,18 @@
|
||||
#[ MyGame.Example.Color
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by :
|
||||
Rooting type : MyGame.Example.Monster ()
|
||||
]#
|
||||
|
||||
# Composite components of Monster color.
|
||||
type Color*{.pure.} = enum
|
||||
Red = 1.uint8,
|
||||
# \brief color Green
|
||||
# Green is bit_flag with value (1u << 1)
|
||||
Green = 2.uint8,
|
||||
# \brief color Blue (1u << 3)
|
||||
Blue = 8.uint8,
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace MyGame\Example;
|
||||
|
||||
/// Composite components of Monster color.
|
||||
class Color
|
||||
{
|
||||
const Red = 1;
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
const Green = 2;
|
||||
/// \brief color Blue (1u << 3)
|
||||
const Blue = 8;
|
||||
|
||||
private static $names = array(
|
||||
Color::Red=>"Red",
|
||||
Color::Green=>"Green",
|
||||
Color::Blue=>"Blue",
|
||||
);
|
||||
|
||||
public static function Name($e)
|
||||
{
|
||||
if (!isset(self::$names[$e])) {
|
||||
throw new \Exception();
|
||||
}
|
||||
return self::$names[$e];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
# Composite components of Monster color.
|
||||
class Color(object):
|
||||
Red = 1
|
||||
# \brief color Green
|
||||
# Green is bit_flag with value (1u << 1)
|
||||
Green = 2
|
||||
# \brief color Blue (1u << 3)
|
||||
Blue = 8
|
||||
@@ -0,0 +1,18 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
[System.FlagsAttribute]
|
||||
public enum LongEnum : ulong
|
||||
{
|
||||
LongOne = 2,
|
||||
LongTwo = 4,
|
||||
LongBig = 1099511627776,
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package Example
|
||||
|
||||
import "strconv"
|
||||
|
||||
type LongEnum uint64
|
||||
|
||||
const (
|
||||
LongEnumLongOne LongEnum = 2
|
||||
LongEnumLongTwo LongEnum = 4
|
||||
LongEnumLongBig LongEnum = 1099511627776
|
||||
)
|
||||
|
||||
var EnumNamesLongEnum = map[LongEnum]string{
|
||||
LongEnumLongOne: "LongOne",
|
||||
LongEnumLongTwo: "LongTwo",
|
||||
LongEnumLongBig: "LongBig",
|
||||
}
|
||||
|
||||
var EnumValuesLongEnum = map[string]LongEnum{
|
||||
"LongOne": LongEnumLongOne,
|
||||
"LongTwo": LongEnumLongTwo,
|
||||
"LongBig": LongEnumLongBig,
|
||||
}
|
||||
|
||||
func (v LongEnum) String() string {
|
||||
if s, ok := EnumNamesLongEnum[v]; ok {
|
||||
return s
|
||||
}
|
||||
return "LongEnum(" + strconv.FormatInt(int64(v), 10) + ")"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class LongEnum {
|
||||
private LongEnum() { }
|
||||
public static final long LongOne = 2L;
|
||||
public static final long LongTwo = 4L;
|
||||
public static final long LongBig = 1099511627776L;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example
|
||||
|
||||
@Suppress("unused")
|
||||
class LongEnum private constructor() {
|
||||
companion object {
|
||||
const val LongOne: ULong = 2UL
|
||||
const val LongTwo: ULong = 4UL
|
||||
const val LongBig: ULong = 1099511627776UL
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
--[[ MyGame.Example.LongEnum
|
||||
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by : //monster_test.fbs
|
||||
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
|
||||
|
||||
--]]
|
||||
|
||||
local LongEnum = {
|
||||
LongOne = 2,
|
||||
LongTwo = 4,
|
||||
LongBig = 1099511627776,
|
||||
}
|
||||
|
||||
return LongEnum
|
||||
@@ -0,0 +1,14 @@
|
||||
#[ MyGame.Example.LongEnum
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by :
|
||||
Rooting type : MyGame.Example.Monster ()
|
||||
]#
|
||||
|
||||
type LongEnum*{.pure.} = enum
|
||||
LongOne = 2.uint64,
|
||||
LongTwo = 4.uint64,
|
||||
LongBig = 1099511627776.uint64,
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace MyGame\Example;
|
||||
|
||||
class LongEnum
|
||||
{
|
||||
const LongOne = 2;
|
||||
const LongTwo = 4;
|
||||
const LongBig = 1099511627776;
|
||||
|
||||
private static $names = array(
|
||||
LongEnum::LongOne=>"LongOne",
|
||||
LongEnum::LongTwo=>"LongTwo",
|
||||
LongEnum::LongBig=>"LongBig",
|
||||
);
|
||||
|
||||
public static function Name($e)
|
||||
{
|
||||
if (!isset(self::$names[$e])) {
|
||||
throw new \Exception();
|
||||
}
|
||||
return self::$names[$e];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
class LongEnum(object):
|
||||
LongOne = 2
|
||||
LongTwo = 4
|
||||
LongBig = 1099511627776
|
||||
+1174
File diff suppressed because it is too large
Load Diff
+1854
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,791 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
/**
|
||||
* an example documentation comment: "monster object"
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public final class Monster extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_24_3_25(); }
|
||||
public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); }
|
||||
public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public static boolean MonsterBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MONS"); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public Monster __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public MyGame.Example.Vec3 pos() { return pos(new MyGame.Example.Vec3()); }
|
||||
public MyGame.Example.Vec3 pos(MyGame.Example.Vec3 obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
|
||||
public short mana() { int o = __offset(6); return o != 0 ? bb.getShort(o + bb_pos) : 150; }
|
||||
public boolean mutateMana(short mana) { int o = __offset(6); if (o != 0) { bb.putShort(o + bb_pos, mana); return true; } else { return false; } }
|
||||
public short hp() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) : 100; }
|
||||
public boolean mutateHp(short hp) { int o = __offset(8); if (o != 0) { bb.putShort(o + bb_pos, hp); return true; } else { return false; } }
|
||||
public String name() { int o = __offset(10); return o != 0 ? __string(o + bb_pos) : null; }
|
||||
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(10, 1); }
|
||||
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 10, 1); }
|
||||
public int inventory(int j) { int o = __offset(14); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; }
|
||||
public int inventoryLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteVector inventoryVector() { return inventoryVector(new ByteVector()); }
|
||||
public ByteVector inventoryVector(ByteVector obj) { int o = __offset(14); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer inventoryAsByteBuffer() { return __vector_as_bytebuffer(14, 1); }
|
||||
public ByteBuffer inventoryInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 14, 1); }
|
||||
public boolean mutateInventory(int j, int inventory) { int o = __offset(14); if (o != 0) { bb.put(__vector(o) + j * 1, (byte) inventory); return true; } else { return false; } }
|
||||
public int color() { int o = __offset(16); return o != 0 ? bb.get(o + bb_pos) & 0xFF : 8; }
|
||||
public boolean mutateColor(int color) { int o = __offset(16); if (o != 0) { bb.put(o + bb_pos, (byte) color); return true; } else { return false; } }
|
||||
public byte testType() { int o = __offset(18); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public Table test(Table obj) { int o = __offset(20); return o != 0 ? __union(obj, o + bb_pos) : null; }
|
||||
public MyGame.Example.Test test4(int j) { return test4(new MyGame.Example.Test(), j); }
|
||||
public MyGame.Example.Test test4(MyGame.Example.Test obj, int j) { int o = __offset(22); return o != 0 ? obj.__assign(__vector(o) + j * 4, bb) : null; }
|
||||
public int test4Length() { int o = __offset(22); return o != 0 ? __vector_len(o) : 0; }
|
||||
public MyGame.Example.Test.Vector test4Vector() { return test4Vector(new MyGame.Example.Test.Vector()); }
|
||||
public MyGame.Example.Test.Vector test4Vector(MyGame.Example.Test.Vector obj) { int o = __offset(22); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public String testarrayofstring(int j) { int o = __offset(24); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int testarrayofstringLength() { int o = __offset(24); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector testarrayofstringVector() { return testarrayofstringVector(new StringVector()); }
|
||||
public StringVector testarrayofstringVector(StringVector obj) { int o = __offset(24); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
/**
|
||||
* an example documentation comment: this will end up in the generated code
|
||||
* multiline too
|
||||
*/
|
||||
public MyGame.Example.Monster testarrayoftables(int j) { return testarrayoftables(new MyGame.Example.Monster(), j); }
|
||||
public MyGame.Example.Monster testarrayoftables(MyGame.Example.Monster obj, int j) { int o = __offset(26); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int testarrayoftablesLength() { int o = __offset(26); return o != 0 ? __vector_len(o) : 0; }
|
||||
public MyGame.Example.Monster testarrayoftablesByKey(String key) { int o = __offset(26); return o != 0 ? MyGame.Example.Monster.__lookup_by_key(null, __vector(o), key, bb) : null; }
|
||||
public MyGame.Example.Monster testarrayoftablesByKey(MyGame.Example.Monster obj, String key) { int o = __offset(26); return o != 0 ? MyGame.Example.Monster.__lookup_by_key(obj, __vector(o), key, bb) : null; }
|
||||
public MyGame.Example.Monster.Vector testarrayoftablesVector() { return testarrayoftablesVector(new MyGame.Example.Monster.Vector()); }
|
||||
public MyGame.Example.Monster.Vector testarrayoftablesVector(MyGame.Example.Monster.Vector obj) { int o = __offset(26); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public MyGame.Example.Monster enemy() { return enemy(new MyGame.Example.Monster()); }
|
||||
public MyGame.Example.Monster enemy(MyGame.Example.Monster obj) { int o = __offset(28); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public int testnestedflatbuffer(int j) { int o = __offset(30); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; }
|
||||
public int testnestedflatbufferLength() { int o = __offset(30); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteVector testnestedflatbufferVector() { return testnestedflatbufferVector(new ByteVector()); }
|
||||
public ByteVector testnestedflatbufferVector(ByteVector obj) { int o = __offset(30); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer testnestedflatbufferAsByteBuffer() { return __vector_as_bytebuffer(30, 1); }
|
||||
public ByteBuffer testnestedflatbufferInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 30, 1); }
|
||||
public MyGame.Example.Monster testnestedflatbufferAsMonster() { return testnestedflatbufferAsMonster(new MyGame.Example.Monster()); }
|
||||
public MyGame.Example.Monster testnestedflatbufferAsMonster(MyGame.Example.Monster obj) { int o = __offset(30); return o != 0 ? obj.__assign(__indirect(__vector(o)), bb) : null; }
|
||||
public boolean mutateTestnestedflatbuffer(int j, int testnestedflatbuffer) { int o = __offset(30); if (o != 0) { bb.put(__vector(o) + j * 1, (byte) testnestedflatbuffer); return true; } else { return false; } }
|
||||
public MyGame.Example.Stat testempty() { return testempty(new MyGame.Example.Stat()); }
|
||||
public MyGame.Example.Stat testempty(MyGame.Example.Stat obj) { int o = __offset(32); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public boolean testbool() { int o = __offset(34); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }
|
||||
public boolean mutateTestbool(boolean testbool) { int o = __offset(34); if (o != 0) { bb.put(o + bb_pos, (byte)(testbool ? 1 : 0)); return true; } else { return false; } }
|
||||
public int testhashs32Fnv1() { int o = __offset(36); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public boolean mutateTesthashs32Fnv1(int testhashs32_fnv1) { int o = __offset(36); if (o != 0) { bb.putInt(o + bb_pos, testhashs32_fnv1); return true; } else { return false; } }
|
||||
public long testhashu32Fnv1() { int o = __offset(38); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }
|
||||
public boolean mutateTesthashu32Fnv1(long testhashu32_fnv1) { int o = __offset(38); if (o != 0) { bb.putInt(o + bb_pos, (int) testhashu32_fnv1); return true; } else { return false; } }
|
||||
public long testhashs64Fnv1() { int o = __offset(40); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public boolean mutateTesthashs64Fnv1(long testhashs64_fnv1) { int o = __offset(40); if (o != 0) { bb.putLong(o + bb_pos, testhashs64_fnv1); return true; } else { return false; } }
|
||||
public long testhashu64Fnv1() { int o = __offset(42); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public boolean mutateTesthashu64Fnv1(long testhashu64_fnv1) { int o = __offset(42); if (o != 0) { bb.putLong(o + bb_pos, testhashu64_fnv1); return true; } else { return false; } }
|
||||
public int testhashs32Fnv1a() { int o = __offset(44); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public boolean mutateTesthashs32Fnv1a(int testhashs32_fnv1a) { int o = __offset(44); if (o != 0) { bb.putInt(o + bb_pos, testhashs32_fnv1a); return true; } else { return false; } }
|
||||
public long testhashu32Fnv1a() { int o = __offset(46); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }
|
||||
public boolean mutateTesthashu32Fnv1a(long testhashu32_fnv1a) { int o = __offset(46); if (o != 0) { bb.putInt(o + bb_pos, (int) testhashu32_fnv1a); return true; } else { return false; } }
|
||||
public long testhashs64Fnv1a() { int o = __offset(48); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public boolean mutateTesthashs64Fnv1a(long testhashs64_fnv1a) { int o = __offset(48); if (o != 0) { bb.putLong(o + bb_pos, testhashs64_fnv1a); return true; } else { return false; } }
|
||||
public long testhashu64Fnv1a() { int o = __offset(50); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public boolean mutateTesthashu64Fnv1a(long testhashu64_fnv1a) { int o = __offset(50); if (o != 0) { bb.putLong(o + bb_pos, testhashu64_fnv1a); return true; } else { return false; } }
|
||||
public boolean testarrayofbools(int j) { int o = __offset(52); return o != 0 ? 0!=bb.get(__vector(o) + j * 1) : false; }
|
||||
public int testarrayofboolsLength() { int o = __offset(52); return o != 0 ? __vector_len(o) : 0; }
|
||||
public BooleanVector testarrayofboolsVector() { return testarrayofboolsVector(new BooleanVector()); }
|
||||
public BooleanVector testarrayofboolsVector(BooleanVector obj) { int o = __offset(52); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer testarrayofboolsAsByteBuffer() { return __vector_as_bytebuffer(52, 1); }
|
||||
public ByteBuffer testarrayofboolsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 52, 1); }
|
||||
public boolean mutateTestarrayofbools(int j, boolean testarrayofbools) { int o = __offset(52); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)(testarrayofbools ? 1 : 0)); return true; } else { return false; } }
|
||||
public float testf() { int o = __offset(54); return o != 0 ? bb.getFloat(o + bb_pos) : 3.14159f; }
|
||||
public boolean mutateTestf(float testf) { int o = __offset(54); if (o != 0) { bb.putFloat(o + bb_pos, testf); return true; } else { return false; } }
|
||||
public float testf2() { int o = __offset(56); return o != 0 ? bb.getFloat(o + bb_pos) : 3.0f; }
|
||||
public boolean mutateTestf2(float testf2) { int o = __offset(56); if (o != 0) { bb.putFloat(o + bb_pos, testf2); return true; } else { return false; } }
|
||||
public float testf3() { int o = __offset(58); return o != 0 ? bb.getFloat(o + bb_pos) : 0.0f; }
|
||||
public boolean mutateTestf3(float testf3) { int o = __offset(58); if (o != 0) { bb.putFloat(o + bb_pos, testf3); return true; } else { return false; } }
|
||||
public String testarrayofstring2(int j) { int o = __offset(60); return o != 0 ? __string(__vector(o) + j * 4) : null; }
|
||||
public int testarrayofstring2Length() { int o = __offset(60); return o != 0 ? __vector_len(o) : 0; }
|
||||
public StringVector testarrayofstring2Vector() { return testarrayofstring2Vector(new StringVector()); }
|
||||
public StringVector testarrayofstring2Vector(StringVector obj) { int o = __offset(60); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public MyGame.Example.Ability testarrayofsortedstruct(int j) { return testarrayofsortedstruct(new MyGame.Example.Ability(), j); }
|
||||
public MyGame.Example.Ability testarrayofsortedstruct(MyGame.Example.Ability obj, int j) { int o = __offset(62); return o != 0 ? obj.__assign(__vector(o) + j * 8, bb) : null; }
|
||||
public int testarrayofsortedstructLength() { int o = __offset(62); return o != 0 ? __vector_len(o) : 0; }
|
||||
public MyGame.Example.Ability.Vector testarrayofsortedstructVector() { return testarrayofsortedstructVector(new MyGame.Example.Ability.Vector()); }
|
||||
public MyGame.Example.Ability.Vector testarrayofsortedstructVector(MyGame.Example.Ability.Vector obj) { int o = __offset(62); return o != 0 ? obj.__assign(__vector(o), 8, bb) : null; }
|
||||
public int flex(int j) { int o = __offset(64); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; }
|
||||
public int flexLength() { int o = __offset(64); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteVector flexVector() { return flexVector(new ByteVector()); }
|
||||
public ByteVector flexVector(ByteVector obj) { int o = __offset(64); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer flexAsByteBuffer() { return __vector_as_bytebuffer(64, 1); }
|
||||
public ByteBuffer flexInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 64, 1); }
|
||||
public boolean mutateFlex(int j, int flex) { int o = __offset(64); if (o != 0) { bb.put(__vector(o) + j * 1, (byte) flex); return true; } else { return false; } }
|
||||
public MyGame.Example.Test test5(int j) { return test5(new MyGame.Example.Test(), j); }
|
||||
public MyGame.Example.Test test5(MyGame.Example.Test obj, int j) { int o = __offset(66); return o != 0 ? obj.__assign(__vector(o) + j * 4, bb) : null; }
|
||||
public int test5Length() { int o = __offset(66); return o != 0 ? __vector_len(o) : 0; }
|
||||
public MyGame.Example.Test.Vector test5Vector() { return test5Vector(new MyGame.Example.Test.Vector()); }
|
||||
public MyGame.Example.Test.Vector test5Vector(MyGame.Example.Test.Vector obj) { int o = __offset(66); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public long vectorOfLongs(int j) { int o = __offset(68); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; }
|
||||
public int vectorOfLongsLength() { int o = __offset(68); return o != 0 ? __vector_len(o) : 0; }
|
||||
public LongVector vectorOfLongsVector() { return vectorOfLongsVector(new LongVector()); }
|
||||
public LongVector vectorOfLongsVector(LongVector obj) { int o = __offset(68); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer vectorOfLongsAsByteBuffer() { return __vector_as_bytebuffer(68, 8); }
|
||||
public ByteBuffer vectorOfLongsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 68, 8); }
|
||||
public boolean mutateVectorOfLongs(int j, long vector_of_longs) { int o = __offset(68); if (o != 0) { bb.putLong(__vector(o) + j * 8, vector_of_longs); return true; } else { return false; } }
|
||||
public double vectorOfDoubles(int j) { int o = __offset(70); return o != 0 ? bb.getDouble(__vector(o) + j * 8) : 0; }
|
||||
public int vectorOfDoublesLength() { int o = __offset(70); return o != 0 ? __vector_len(o) : 0; }
|
||||
public DoubleVector vectorOfDoublesVector() { return vectorOfDoublesVector(new DoubleVector()); }
|
||||
public DoubleVector vectorOfDoublesVector(DoubleVector obj) { int o = __offset(70); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer vectorOfDoublesAsByteBuffer() { return __vector_as_bytebuffer(70, 8); }
|
||||
public ByteBuffer vectorOfDoublesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 70, 8); }
|
||||
public boolean mutateVectorOfDoubles(int j, double vector_of_doubles) { int o = __offset(70); if (o != 0) { bb.putDouble(__vector(o) + j * 8, vector_of_doubles); return true; } else { return false; } }
|
||||
public MyGame.InParentNamespace parentNamespaceTest() { return parentNamespaceTest(new MyGame.InParentNamespace()); }
|
||||
public MyGame.InParentNamespace parentNamespaceTest(MyGame.InParentNamespace obj) { int o = __offset(72); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
|
||||
public MyGame.Example.Referrable vectorOfReferrables(int j) { return vectorOfReferrables(new MyGame.Example.Referrable(), j); }
|
||||
public MyGame.Example.Referrable vectorOfReferrables(MyGame.Example.Referrable obj, int j) { int o = __offset(74); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int vectorOfReferrablesLength() { int o = __offset(74); return o != 0 ? __vector_len(o) : 0; }
|
||||
public MyGame.Example.Referrable vectorOfReferrablesByKey(long key) { int o = __offset(74); return o != 0 ? MyGame.Example.Referrable.__lookup_by_key(null, __vector(o), key, bb) : null; }
|
||||
public MyGame.Example.Referrable vectorOfReferrablesByKey(MyGame.Example.Referrable obj, long key) { int o = __offset(74); return o != 0 ? MyGame.Example.Referrable.__lookup_by_key(obj, __vector(o), key, bb) : null; }
|
||||
public MyGame.Example.Referrable.Vector vectorOfReferrablesVector() { return vectorOfReferrablesVector(new MyGame.Example.Referrable.Vector()); }
|
||||
public MyGame.Example.Referrable.Vector vectorOfReferrablesVector(MyGame.Example.Referrable.Vector obj) { int o = __offset(74); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public long singleWeakReference() { int o = __offset(76); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public boolean mutateSingleWeakReference(long single_weak_reference) { int o = __offset(76); if (o != 0) { bb.putLong(o + bb_pos, single_weak_reference); return true; } else { return false; } }
|
||||
public long vectorOfWeakReferences(int j) { int o = __offset(78); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; }
|
||||
public int vectorOfWeakReferencesLength() { int o = __offset(78); return o != 0 ? __vector_len(o) : 0; }
|
||||
public LongVector vectorOfWeakReferencesVector() { return vectorOfWeakReferencesVector(new LongVector()); }
|
||||
public LongVector vectorOfWeakReferencesVector(LongVector obj) { int o = __offset(78); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer vectorOfWeakReferencesAsByteBuffer() { return __vector_as_bytebuffer(78, 8); }
|
||||
public ByteBuffer vectorOfWeakReferencesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 78, 8); }
|
||||
public boolean mutateVectorOfWeakReferences(int j, long vector_of_weak_references) { int o = __offset(78); if (o != 0) { bb.putLong(__vector(o) + j * 8, vector_of_weak_references); return true; } else { return false; } }
|
||||
public MyGame.Example.Referrable vectorOfStrongReferrables(int j) { return vectorOfStrongReferrables(new MyGame.Example.Referrable(), j); }
|
||||
public MyGame.Example.Referrable vectorOfStrongReferrables(MyGame.Example.Referrable obj, int j) { int o = __offset(80); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int vectorOfStrongReferrablesLength() { int o = __offset(80); return o != 0 ? __vector_len(o) : 0; }
|
||||
public MyGame.Example.Referrable vectorOfStrongReferrablesByKey(long key) { int o = __offset(80); return o != 0 ? MyGame.Example.Referrable.__lookup_by_key(null, __vector(o), key, bb) : null; }
|
||||
public MyGame.Example.Referrable vectorOfStrongReferrablesByKey(MyGame.Example.Referrable obj, long key) { int o = __offset(80); return o != 0 ? MyGame.Example.Referrable.__lookup_by_key(obj, __vector(o), key, bb) : null; }
|
||||
public MyGame.Example.Referrable.Vector vectorOfStrongReferrablesVector() { return vectorOfStrongReferrablesVector(new MyGame.Example.Referrable.Vector()); }
|
||||
public MyGame.Example.Referrable.Vector vectorOfStrongReferrablesVector(MyGame.Example.Referrable.Vector obj) { int o = __offset(80); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public long coOwningReference() { int o = __offset(82); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public boolean mutateCoOwningReference(long co_owning_reference) { int o = __offset(82); if (o != 0) { bb.putLong(o + bb_pos, co_owning_reference); return true; } else { return false; } }
|
||||
public long vectorOfCoOwningReferences(int j) { int o = __offset(84); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; }
|
||||
public int vectorOfCoOwningReferencesLength() { int o = __offset(84); return o != 0 ? __vector_len(o) : 0; }
|
||||
public LongVector vectorOfCoOwningReferencesVector() { return vectorOfCoOwningReferencesVector(new LongVector()); }
|
||||
public LongVector vectorOfCoOwningReferencesVector(LongVector obj) { int o = __offset(84); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer vectorOfCoOwningReferencesAsByteBuffer() { return __vector_as_bytebuffer(84, 8); }
|
||||
public ByteBuffer vectorOfCoOwningReferencesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 84, 8); }
|
||||
public boolean mutateVectorOfCoOwningReferences(int j, long vector_of_co_owning_references) { int o = __offset(84); if (o != 0) { bb.putLong(__vector(o) + j * 8, vector_of_co_owning_references); return true; } else { return false; } }
|
||||
public long nonOwningReference() { int o = __offset(86); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public boolean mutateNonOwningReference(long non_owning_reference) { int o = __offset(86); if (o != 0) { bb.putLong(o + bb_pos, non_owning_reference); return true; } else { return false; } }
|
||||
public long vectorOfNonOwningReferences(int j) { int o = __offset(88); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; }
|
||||
public int vectorOfNonOwningReferencesLength() { int o = __offset(88); return o != 0 ? __vector_len(o) : 0; }
|
||||
public LongVector vectorOfNonOwningReferencesVector() { return vectorOfNonOwningReferencesVector(new LongVector()); }
|
||||
public LongVector vectorOfNonOwningReferencesVector(LongVector obj) { int o = __offset(88); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer vectorOfNonOwningReferencesAsByteBuffer() { return __vector_as_bytebuffer(88, 8); }
|
||||
public ByteBuffer vectorOfNonOwningReferencesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 88, 8); }
|
||||
public boolean mutateVectorOfNonOwningReferences(int j, long vector_of_non_owning_references) { int o = __offset(88); if (o != 0) { bb.putLong(__vector(o) + j * 8, vector_of_non_owning_references); return true; } else { return false; } }
|
||||
public byte anyUniqueType() { int o = __offset(90); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public Table anyUnique(Table obj) { int o = __offset(92); return o != 0 ? __union(obj, o + bb_pos) : null; }
|
||||
public byte anyAmbiguousType() { int o = __offset(94); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public Table anyAmbiguous(Table obj) { int o = __offset(96); return o != 0 ? __union(obj, o + bb_pos) : null; }
|
||||
public int vectorOfEnums(int j) { int o = __offset(98); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; }
|
||||
public int vectorOfEnumsLength() { int o = __offset(98); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteVector vectorOfEnumsVector() { return vectorOfEnumsVector(new ByteVector()); }
|
||||
public ByteVector vectorOfEnumsVector(ByteVector obj) { int o = __offset(98); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer vectorOfEnumsAsByteBuffer() { return __vector_as_bytebuffer(98, 1); }
|
||||
public ByteBuffer vectorOfEnumsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 98, 1); }
|
||||
public boolean mutateVectorOfEnums(int j, int vector_of_enums) { int o = __offset(98); if (o != 0) { bb.put(__vector(o) + j * 1, (byte) vector_of_enums); return true; } else { return false; } }
|
||||
public byte signedEnum() { int o = __offset(100); return o != 0 ? bb.get(o + bb_pos) : -1; }
|
||||
public boolean mutateSignedEnum(byte signed_enum) { int o = __offset(100); if (o != 0) { bb.put(o + bb_pos, signed_enum); return true; } else { return false; } }
|
||||
public int testrequirednestedflatbuffer(int j) { int o = __offset(102); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; }
|
||||
public int testrequirednestedflatbufferLength() { int o = __offset(102); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteVector testrequirednestedflatbufferVector() { return testrequirednestedflatbufferVector(new ByteVector()); }
|
||||
public ByteVector testrequirednestedflatbufferVector(ByteVector obj) { int o = __offset(102); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
|
||||
public ByteBuffer testrequirednestedflatbufferAsByteBuffer() { return __vector_as_bytebuffer(102, 1); }
|
||||
public ByteBuffer testrequirednestedflatbufferInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 102, 1); }
|
||||
public MyGame.Example.Monster testrequirednestedflatbufferAsMonster() { return testrequirednestedflatbufferAsMonster(new MyGame.Example.Monster()); }
|
||||
public MyGame.Example.Monster testrequirednestedflatbufferAsMonster(MyGame.Example.Monster obj) { int o = __offset(102); return o != 0 ? obj.__assign(__indirect(__vector(o)), bb) : null; }
|
||||
public boolean mutateTestrequirednestedflatbuffer(int j, int testrequirednestedflatbuffer) { int o = __offset(102); if (o != 0) { bb.put(__vector(o) + j * 1, (byte) testrequirednestedflatbuffer); return true; } else { return false; } }
|
||||
public MyGame.Example.Stat scalarKeySortedTables(int j) { return scalarKeySortedTables(new MyGame.Example.Stat(), j); }
|
||||
public MyGame.Example.Stat scalarKeySortedTables(MyGame.Example.Stat obj, int j) { int o = __offset(104); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
|
||||
public int scalarKeySortedTablesLength() { int o = __offset(104); return o != 0 ? __vector_len(o) : 0; }
|
||||
public MyGame.Example.Stat scalarKeySortedTablesByKey(int key) { int o = __offset(104); return o != 0 ? MyGame.Example.Stat.__lookup_by_key(null, __vector(o), key, bb) : null; }
|
||||
public MyGame.Example.Stat scalarKeySortedTablesByKey(MyGame.Example.Stat obj, int key) { int o = __offset(104); return o != 0 ? MyGame.Example.Stat.__lookup_by_key(obj, __vector(o), key, bb) : null; }
|
||||
public MyGame.Example.Stat.Vector scalarKeySortedTablesVector() { return scalarKeySortedTablesVector(new MyGame.Example.Stat.Vector()); }
|
||||
public MyGame.Example.Stat.Vector scalarKeySortedTablesVector(MyGame.Example.Stat.Vector obj) { int o = __offset(104); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
|
||||
public MyGame.Example.Test nativeInline() { return nativeInline(new MyGame.Example.Test()); }
|
||||
public MyGame.Example.Test nativeInline(MyGame.Example.Test obj) { int o = __offset(106); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
|
||||
public long longEnumNonEnumDefault() { int o = __offset(108); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public boolean mutateLongEnumNonEnumDefault(long long_enum_non_enum_default) { int o = __offset(108); if (o != 0) { bb.putLong(o + bb_pos, long_enum_non_enum_default); return true; } else { return false; } }
|
||||
public long longEnumNormalDefault() { int o = __offset(110); return o != 0 ? bb.getLong(o + bb_pos) : 2L; }
|
||||
public boolean mutateLongEnumNormalDefault(long long_enum_normal_default) { int o = __offset(110); if (o != 0) { bb.putLong(o + bb_pos, long_enum_normal_default); return true; } else { return false; } }
|
||||
public float nanDefault() { int o = __offset(112); return o != 0 ? bb.getFloat(o + bb_pos) : Float.NaN; }
|
||||
public boolean mutateNanDefault(float nan_default) { int o = __offset(112); if (o != 0) { bb.putFloat(o + bb_pos, nan_default); return true; } else { return false; } }
|
||||
public float infDefault() { int o = __offset(114); return o != 0 ? bb.getFloat(o + bb_pos) : Float.POSITIVE_INFINITY; }
|
||||
public boolean mutateInfDefault(float inf_default) { int o = __offset(114); if (o != 0) { bb.putFloat(o + bb_pos, inf_default); return true; } else { return false; } }
|
||||
public float positiveInfDefault() { int o = __offset(116); return o != 0 ? bb.getFloat(o + bb_pos) : Float.POSITIVE_INFINITY; }
|
||||
public boolean mutatePositiveInfDefault(float positive_inf_default) { int o = __offset(116); if (o != 0) { bb.putFloat(o + bb_pos, positive_inf_default); return true; } else { return false; } }
|
||||
public float infinityDefault() { int o = __offset(118); return o != 0 ? bb.getFloat(o + bb_pos) : Float.POSITIVE_INFINITY; }
|
||||
public boolean mutateInfinityDefault(float infinity_default) { int o = __offset(118); if (o != 0) { bb.putFloat(o + bb_pos, infinity_default); return true; } else { return false; } }
|
||||
public float positiveInfinityDefault() { int o = __offset(120); return o != 0 ? bb.getFloat(o + bb_pos) : Float.POSITIVE_INFINITY; }
|
||||
public boolean mutatePositiveInfinityDefault(float positive_infinity_default) { int o = __offset(120); if (o != 0) { bb.putFloat(o + bb_pos, positive_infinity_default); return true; } else { return false; } }
|
||||
public float negativeInfDefault() { int o = __offset(122); return o != 0 ? bb.getFloat(o + bb_pos) : Float.NEGATIVE_INFINITY; }
|
||||
public boolean mutateNegativeInfDefault(float negative_inf_default) { int o = __offset(122); if (o != 0) { bb.putFloat(o + bb_pos, negative_inf_default); return true; } else { return false; } }
|
||||
public float negativeInfinityDefault() { int o = __offset(124); return o != 0 ? bb.getFloat(o + bb_pos) : Float.NEGATIVE_INFINITY; }
|
||||
public boolean mutateNegativeInfinityDefault(float negative_infinity_default) { int o = __offset(124); if (o != 0) { bb.putFloat(o + bb_pos, negative_infinity_default); return true; } else { return false; } }
|
||||
public double doubleInfDefault() { int o = __offset(126); return o != 0 ? bb.getDouble(o + bb_pos) : Double.POSITIVE_INFINITY; }
|
||||
public boolean mutateDoubleInfDefault(double double_inf_default) { int o = __offset(126); if (o != 0) { bb.putDouble(o + bb_pos, double_inf_default); return true; } else { return false; } }
|
||||
|
||||
public static void startMonster(FlatBufferBuilder builder) { builder.startTable(62); }
|
||||
public static void addPos(FlatBufferBuilder builder, int posOffset) { builder.addStruct(0, posOffset, 0); }
|
||||
public static void addMana(FlatBufferBuilder builder, short mana) { builder.addShort(1, mana, 150); }
|
||||
public static void addHp(FlatBufferBuilder builder, short hp) { builder.addShort(2, hp, 100); }
|
||||
public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(nameOffset); builder.slot(3); }
|
||||
public static void addInventory(FlatBufferBuilder builder, int inventoryOffset) { builder.addOffset(5, inventoryOffset, 0); }
|
||||
public static int createInventoryVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
|
||||
public static int createInventoryVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
|
||||
public static void startInventoryVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addColor(FlatBufferBuilder builder, int color) { builder.addByte(6, (byte) color, (byte) 8); }
|
||||
public static void addTestType(FlatBufferBuilder builder, byte testType) { builder.addByte(7, testType, 0); }
|
||||
public static void addTest(FlatBufferBuilder builder, int testOffset) { builder.addOffset(8, testOffset, 0); }
|
||||
public static void addTest4(FlatBufferBuilder builder, int test4Offset) { builder.addOffset(9, test4Offset, 0); }
|
||||
public static void startTest4Vector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 2); }
|
||||
public static void addTestarrayofstring(FlatBufferBuilder builder, int testarrayofstringOffset) { builder.addOffset(10, testarrayofstringOffset, 0); }
|
||||
public static int createTestarrayofstringVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startTestarrayofstringVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addTestarrayoftables(FlatBufferBuilder builder, int testarrayoftablesOffset) { builder.addOffset(11, testarrayoftablesOffset, 0); }
|
||||
public static int createTestarrayoftablesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startTestarrayoftablesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addEnemy(FlatBufferBuilder builder, int enemyOffset) { builder.addOffset(12, enemyOffset, 0); }
|
||||
public static void addTestnestedflatbuffer(FlatBufferBuilder builder, int testnestedflatbufferOffset) { builder.addOffset(13, testnestedflatbufferOffset, 0); }
|
||||
public static int createTestnestedflatbufferVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
|
||||
public static int createTestnestedflatbufferVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
|
||||
public static void startTestnestedflatbufferVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addTestempty(FlatBufferBuilder builder, int testemptyOffset) { builder.addOffset(14, testemptyOffset, 0); }
|
||||
public static void addTestbool(FlatBufferBuilder builder, boolean testbool) { builder.addBoolean(15, testbool, false); }
|
||||
public static void addTesthashs32Fnv1(FlatBufferBuilder builder, int testhashs32Fnv1) { builder.addInt(16, testhashs32Fnv1, 0); }
|
||||
public static void addTesthashu32Fnv1(FlatBufferBuilder builder, long testhashu32Fnv1) { builder.addInt(17, (int) testhashu32Fnv1, (int) 0L); }
|
||||
public static void addTesthashs64Fnv1(FlatBufferBuilder builder, long testhashs64Fnv1) { builder.addLong(18, testhashs64Fnv1, 0L); }
|
||||
public static void addTesthashu64Fnv1(FlatBufferBuilder builder, long testhashu64Fnv1) { builder.addLong(19, testhashu64Fnv1, 0L); }
|
||||
public static void addTesthashs32Fnv1a(FlatBufferBuilder builder, int testhashs32Fnv1a) { builder.addInt(20, testhashs32Fnv1a, 0); }
|
||||
public static void addTesthashu32Fnv1a(FlatBufferBuilder builder, long testhashu32Fnv1a) { builder.addInt(21, (int) testhashu32Fnv1a, (int) 0L); }
|
||||
public static void addTesthashs64Fnv1a(FlatBufferBuilder builder, long testhashs64Fnv1a) { builder.addLong(22, testhashs64Fnv1a, 0L); }
|
||||
public static void addTesthashu64Fnv1a(FlatBufferBuilder builder, long testhashu64Fnv1a) { builder.addLong(23, testhashu64Fnv1a, 0L); }
|
||||
public static void addTestarrayofbools(FlatBufferBuilder builder, int testarrayofboolsOffset) { builder.addOffset(24, testarrayofboolsOffset, 0); }
|
||||
public static int createTestarrayofboolsVector(FlatBufferBuilder builder, boolean[] data) { builder.startVector(1, data.length, 1); for (int i = data.length - 1; i >= 0; i--) builder.addBoolean(data[i]); return builder.endVector(); }
|
||||
public static void startTestarrayofboolsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addTestf(FlatBufferBuilder builder, float testf) { builder.addFloat(25, testf, 3.14159f); }
|
||||
public static void addTestf2(FlatBufferBuilder builder, float testf2) { builder.addFloat(26, testf2, 3.0f); }
|
||||
public static void addTestf3(FlatBufferBuilder builder, float testf3) { builder.addFloat(27, testf3, 0.0f); }
|
||||
public static void addTestarrayofstring2(FlatBufferBuilder builder, int testarrayofstring2Offset) { builder.addOffset(28, testarrayofstring2Offset, 0); }
|
||||
public static int createTestarrayofstring2Vector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startTestarrayofstring2Vector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addTestarrayofsortedstruct(FlatBufferBuilder builder, int testarrayofsortedstructOffset) { builder.addOffset(29, testarrayofsortedstructOffset, 0); }
|
||||
public static void startTestarrayofsortedstructVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 4); }
|
||||
public static void addFlex(FlatBufferBuilder builder, int flexOffset) { builder.addOffset(30, flexOffset, 0); }
|
||||
public static int createFlexVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
|
||||
public static int createFlexVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
|
||||
public static void startFlexVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addTest5(FlatBufferBuilder builder, int test5Offset) { builder.addOffset(31, test5Offset, 0); }
|
||||
public static void startTest5Vector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 2); }
|
||||
public static void addVectorOfLongs(FlatBufferBuilder builder, int vectorOfLongsOffset) { builder.addOffset(32, vectorOfLongsOffset, 0); }
|
||||
public static int createVectorOfLongsVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); }
|
||||
public static void startVectorOfLongsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addVectorOfDoubles(FlatBufferBuilder builder, int vectorOfDoublesOffset) { builder.addOffset(33, vectorOfDoublesOffset, 0); }
|
||||
public static int createVectorOfDoublesVector(FlatBufferBuilder builder, double[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addDouble(data[i]); return builder.endVector(); }
|
||||
public static void startVectorOfDoublesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addParentNamespaceTest(FlatBufferBuilder builder, int parentNamespaceTestOffset) { builder.addOffset(34, parentNamespaceTestOffset, 0); }
|
||||
public static void addVectorOfReferrables(FlatBufferBuilder builder, int vectorOfReferrablesOffset) { builder.addOffset(35, vectorOfReferrablesOffset, 0); }
|
||||
public static int createVectorOfReferrablesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startVectorOfReferrablesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addSingleWeakReference(FlatBufferBuilder builder, long singleWeakReference) { builder.addLong(36, singleWeakReference, 0L); }
|
||||
public static void addVectorOfWeakReferences(FlatBufferBuilder builder, int vectorOfWeakReferencesOffset) { builder.addOffset(37, vectorOfWeakReferencesOffset, 0); }
|
||||
public static int createVectorOfWeakReferencesVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); }
|
||||
public static void startVectorOfWeakReferencesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addVectorOfStrongReferrables(FlatBufferBuilder builder, int vectorOfStrongReferrablesOffset) { builder.addOffset(38, vectorOfStrongReferrablesOffset, 0); }
|
||||
public static int createVectorOfStrongReferrablesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startVectorOfStrongReferrablesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addCoOwningReference(FlatBufferBuilder builder, long coOwningReference) { builder.addLong(39, coOwningReference, 0L); }
|
||||
public static void addVectorOfCoOwningReferences(FlatBufferBuilder builder, int vectorOfCoOwningReferencesOffset) { builder.addOffset(40, vectorOfCoOwningReferencesOffset, 0); }
|
||||
public static int createVectorOfCoOwningReferencesVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); }
|
||||
public static void startVectorOfCoOwningReferencesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addNonOwningReference(FlatBufferBuilder builder, long nonOwningReference) { builder.addLong(41, nonOwningReference, 0L); }
|
||||
public static void addVectorOfNonOwningReferences(FlatBufferBuilder builder, int vectorOfNonOwningReferencesOffset) { builder.addOffset(42, vectorOfNonOwningReferencesOffset, 0); }
|
||||
public static int createVectorOfNonOwningReferencesVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); }
|
||||
public static void startVectorOfNonOwningReferencesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static void addAnyUniqueType(FlatBufferBuilder builder, byte anyUniqueType) { builder.addByte(43, anyUniqueType, 0); }
|
||||
public static void addAnyUnique(FlatBufferBuilder builder, int anyUniqueOffset) { builder.addOffset(44, anyUniqueOffset, 0); }
|
||||
public static void addAnyAmbiguousType(FlatBufferBuilder builder, byte anyAmbiguousType) { builder.addByte(45, anyAmbiguousType, 0); }
|
||||
public static void addAnyAmbiguous(FlatBufferBuilder builder, int anyAmbiguousOffset) { builder.addOffset(46, anyAmbiguousOffset, 0); }
|
||||
public static void addVectorOfEnums(FlatBufferBuilder builder, int vectorOfEnumsOffset) { builder.addOffset(47, vectorOfEnumsOffset, 0); }
|
||||
public static int createVectorOfEnumsVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
|
||||
public static int createVectorOfEnumsVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
|
||||
public static void startVectorOfEnumsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addSignedEnum(FlatBufferBuilder builder, byte signedEnum) { builder.addByte(48, signedEnum, -1); }
|
||||
public static void addTestrequirednestedflatbuffer(FlatBufferBuilder builder, int testrequirednestedflatbufferOffset) { builder.addOffset(49, testrequirednestedflatbufferOffset, 0); }
|
||||
public static int createTestrequirednestedflatbufferVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
|
||||
public static int createTestrequirednestedflatbufferVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
|
||||
public static void startTestrequirednestedflatbufferVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addScalarKeySortedTables(FlatBufferBuilder builder, int scalarKeySortedTablesOffset) { builder.addOffset(50, scalarKeySortedTablesOffset, 0); }
|
||||
public static int createScalarKeySortedTablesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
|
||||
public static void startScalarKeySortedTablesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
|
||||
public static void addNativeInline(FlatBufferBuilder builder, int nativeInlineOffset) { builder.addStruct(51, nativeInlineOffset, 0); }
|
||||
public static void addLongEnumNonEnumDefault(FlatBufferBuilder builder, long longEnumNonEnumDefault) { builder.addLong(52, longEnumNonEnumDefault, 0L); }
|
||||
public static void addLongEnumNormalDefault(FlatBufferBuilder builder, long longEnumNormalDefault) { builder.addLong(53, longEnumNormalDefault, 2L); }
|
||||
public static void addNanDefault(FlatBufferBuilder builder, float nanDefault) { builder.addFloat(54, nanDefault, Float.NaN); }
|
||||
public static void addInfDefault(FlatBufferBuilder builder, float infDefault) { builder.addFloat(55, infDefault, Float.POSITIVE_INFINITY); }
|
||||
public static void addPositiveInfDefault(FlatBufferBuilder builder, float positiveInfDefault) { builder.addFloat(56, positiveInfDefault, Float.POSITIVE_INFINITY); }
|
||||
public static void addInfinityDefault(FlatBufferBuilder builder, float infinityDefault) { builder.addFloat(57, infinityDefault, Float.POSITIVE_INFINITY); }
|
||||
public static void addPositiveInfinityDefault(FlatBufferBuilder builder, float positiveInfinityDefault) { builder.addFloat(58, positiveInfinityDefault, Float.POSITIVE_INFINITY); }
|
||||
public static void addNegativeInfDefault(FlatBufferBuilder builder, float negativeInfDefault) { builder.addFloat(59, negativeInfDefault, Float.NEGATIVE_INFINITY); }
|
||||
public static void addNegativeInfinityDefault(FlatBufferBuilder builder, float negativeInfinityDefault) { builder.addFloat(60, negativeInfinityDefault, Float.NEGATIVE_INFINITY); }
|
||||
public static void addDoubleInfDefault(FlatBufferBuilder builder, double doubleInfDefault) { builder.addDouble(61, doubleInfDefault, Double.POSITIVE_INFINITY); }
|
||||
public static int endMonster(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
builder.required(o, 10); // name
|
||||
return o;
|
||||
}
|
||||
public static void finishMonsterBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset, "MONS"); }
|
||||
public static void finishSizePrefixedMonsterBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset, "MONS"); }
|
||||
|
||||
@Override
|
||||
protected int keysCompare(Integer o1, Integer o2, ByteBuffer _bb) { return compareStrings(__offset(10, o1, _bb), __offset(10, o2, _bb), _bb); }
|
||||
|
||||
public static Monster __lookup_by_key(Monster obj, int vectorLocation, String key, ByteBuffer bb) {
|
||||
byte[] byteKey = key.getBytes(java.nio.charset.StandardCharsets.UTF_8);
|
||||
int span = bb.getInt(vectorLocation - 4);
|
||||
int start = 0;
|
||||
while (span != 0) {
|
||||
int middle = span / 2;
|
||||
int tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb);
|
||||
int comp = compareStrings(__offset(10, bb.capacity() - tableOffset, bb), byteKey, bb);
|
||||
if (comp > 0) {
|
||||
span = middle;
|
||||
} else if (comp < 0) {
|
||||
middle++;
|
||||
start += middle;
|
||||
span -= middle;
|
||||
} else {
|
||||
return (obj == null ? new Monster() : obj).__assign(tableOffset, bb);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public Monster get(int j) { return get(new Monster(), j); }
|
||||
public Monster get(Monster obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
public Monster getByKey(String key) { return __lookup_by_key(null, __vector(), key, bb); }
|
||||
public Monster getByKey(Monster obj, String key) { return __lookup_by_key(obj, __vector(), key, bb); }
|
||||
}
|
||||
public MonsterT unpack() {
|
||||
MonsterT _o = new MonsterT();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(MonsterT _o) {
|
||||
if (pos() != null) pos().unpackTo(_o.getPos());
|
||||
else _o.setPos(null);
|
||||
short _oMana = mana();
|
||||
_o.setMana(_oMana);
|
||||
short _oHp = hp();
|
||||
_o.setHp(_oHp);
|
||||
String _oName = name();
|
||||
_o.setName(_oName);
|
||||
int[] _oInventory = new int[inventoryLength()];
|
||||
for (int _j = 0; _j < inventoryLength(); ++_j) {_oInventory[_j] = inventory(_j);}
|
||||
_o.setInventory(_oInventory);
|
||||
int _oColor = color();
|
||||
_o.setColor(_oColor);
|
||||
MyGame.Example.AnyUnion _oTest = new MyGame.Example.AnyUnion();
|
||||
byte _oTestType = testType();
|
||||
_oTest.setType(_oTestType);
|
||||
Table _oTestValue;
|
||||
switch (_oTestType) {
|
||||
case MyGame.Example.Any.Monster:
|
||||
_oTestValue = test(new MyGame.Example.Monster());
|
||||
_oTest.setValue(_oTestValue != null ? ((MyGame.Example.Monster) _oTestValue).unpack() : null);
|
||||
break;
|
||||
case MyGame.Example.Any.TestSimpleTableWithEnum:
|
||||
_oTestValue = test(new MyGame.Example.TestSimpleTableWithEnum());
|
||||
_oTest.setValue(_oTestValue != null ? ((MyGame.Example.TestSimpleTableWithEnum) _oTestValue).unpack() : null);
|
||||
break;
|
||||
case MyGame.Example.Any.MyGame_Example2_Monster:
|
||||
_oTestValue = test(new MyGame.Example2.Monster());
|
||||
_oTest.setValue(_oTestValue != null ? ((MyGame.Example2.Monster) _oTestValue).unpack() : null);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
_o.setTest(_oTest);
|
||||
MyGame.Example.TestT[] _oTest4 = new MyGame.Example.TestT[test4Length()];
|
||||
for (int _j = 0; _j < test4Length(); ++_j) {_oTest4[_j] = (test4(_j) != null ? test4(_j).unpack() : null);}
|
||||
_o.setTest4(_oTest4);
|
||||
String[] _oTestarrayofstring = new String[testarrayofstringLength()];
|
||||
for (int _j = 0; _j < testarrayofstringLength(); ++_j) {_oTestarrayofstring[_j] = testarrayofstring(_j);}
|
||||
_o.setTestarrayofstring(_oTestarrayofstring);
|
||||
MyGame.Example.MonsterT[] _oTestarrayoftables = new MyGame.Example.MonsterT[testarrayoftablesLength()];
|
||||
for (int _j = 0; _j < testarrayoftablesLength(); ++_j) {_oTestarrayoftables[_j] = (testarrayoftables(_j) != null ? testarrayoftables(_j).unpack() : null);}
|
||||
_o.setTestarrayoftables(_oTestarrayoftables);
|
||||
if (enemy() != null) _o.setEnemy(enemy().unpack());
|
||||
else _o.setEnemy(null);
|
||||
int[] _oTestnestedflatbuffer = new int[testnestedflatbufferLength()];
|
||||
for (int _j = 0; _j < testnestedflatbufferLength(); ++_j) {_oTestnestedflatbuffer[_j] = testnestedflatbuffer(_j);}
|
||||
_o.setTestnestedflatbuffer(_oTestnestedflatbuffer);
|
||||
if (testempty() != null) _o.setTestempty(testempty().unpack());
|
||||
else _o.setTestempty(null);
|
||||
boolean _oTestbool = testbool();
|
||||
_o.setTestbool(_oTestbool);
|
||||
int _oTesthashs32Fnv1 = testhashs32Fnv1();
|
||||
_o.setTesthashs32Fnv1(_oTesthashs32Fnv1);
|
||||
long _oTesthashu32Fnv1 = testhashu32Fnv1();
|
||||
_o.setTesthashu32Fnv1(_oTesthashu32Fnv1);
|
||||
long _oTesthashs64Fnv1 = testhashs64Fnv1();
|
||||
_o.setTesthashs64Fnv1(_oTesthashs64Fnv1);
|
||||
long _oTesthashu64Fnv1 = testhashu64Fnv1();
|
||||
_o.setTesthashu64Fnv1(_oTesthashu64Fnv1);
|
||||
int _oTesthashs32Fnv1a = testhashs32Fnv1a();
|
||||
_o.setTesthashs32Fnv1a(_oTesthashs32Fnv1a);
|
||||
long _oTesthashu32Fnv1a = testhashu32Fnv1a();
|
||||
_o.setTesthashu32Fnv1a(_oTesthashu32Fnv1a);
|
||||
long _oTesthashs64Fnv1a = testhashs64Fnv1a();
|
||||
_o.setTesthashs64Fnv1a(_oTesthashs64Fnv1a);
|
||||
long _oTesthashu64Fnv1a = testhashu64Fnv1a();
|
||||
_o.setTesthashu64Fnv1a(_oTesthashu64Fnv1a);
|
||||
boolean[] _oTestarrayofbools = new boolean[testarrayofboolsLength()];
|
||||
for (int _j = 0; _j < testarrayofboolsLength(); ++_j) {_oTestarrayofbools[_j] = testarrayofbools(_j);}
|
||||
_o.setTestarrayofbools(_oTestarrayofbools);
|
||||
float _oTestf = testf();
|
||||
_o.setTestf(_oTestf);
|
||||
float _oTestf2 = testf2();
|
||||
_o.setTestf2(_oTestf2);
|
||||
float _oTestf3 = testf3();
|
||||
_o.setTestf3(_oTestf3);
|
||||
String[] _oTestarrayofstring2 = new String[testarrayofstring2Length()];
|
||||
for (int _j = 0; _j < testarrayofstring2Length(); ++_j) {_oTestarrayofstring2[_j] = testarrayofstring2(_j);}
|
||||
_o.setTestarrayofstring2(_oTestarrayofstring2);
|
||||
MyGame.Example.AbilityT[] _oTestarrayofsortedstruct = new MyGame.Example.AbilityT[testarrayofsortedstructLength()];
|
||||
for (int _j = 0; _j < testarrayofsortedstructLength(); ++_j) {_oTestarrayofsortedstruct[_j] = (testarrayofsortedstruct(_j) != null ? testarrayofsortedstruct(_j).unpack() : null);}
|
||||
_o.setTestarrayofsortedstruct(_oTestarrayofsortedstruct);
|
||||
int[] _oFlex = new int[flexLength()];
|
||||
for (int _j = 0; _j < flexLength(); ++_j) {_oFlex[_j] = flex(_j);}
|
||||
_o.setFlex(_oFlex);
|
||||
MyGame.Example.TestT[] _oTest5 = new MyGame.Example.TestT[test5Length()];
|
||||
for (int _j = 0; _j < test5Length(); ++_j) {_oTest5[_j] = (test5(_j) != null ? test5(_j).unpack() : null);}
|
||||
_o.setTest5(_oTest5);
|
||||
long[] _oVectorOfLongs = new long[vectorOfLongsLength()];
|
||||
for (int _j = 0; _j < vectorOfLongsLength(); ++_j) {_oVectorOfLongs[_j] = vectorOfLongs(_j);}
|
||||
_o.setVectorOfLongs(_oVectorOfLongs);
|
||||
double[] _oVectorOfDoubles = new double[vectorOfDoublesLength()];
|
||||
for (int _j = 0; _j < vectorOfDoublesLength(); ++_j) {_oVectorOfDoubles[_j] = vectorOfDoubles(_j);}
|
||||
_o.setVectorOfDoubles(_oVectorOfDoubles);
|
||||
if (parentNamespaceTest() != null) _o.setParentNamespaceTest(parentNamespaceTest().unpack());
|
||||
else _o.setParentNamespaceTest(null);
|
||||
MyGame.Example.ReferrableT[] _oVectorOfReferrables = new MyGame.Example.ReferrableT[vectorOfReferrablesLength()];
|
||||
for (int _j = 0; _j < vectorOfReferrablesLength(); ++_j) {_oVectorOfReferrables[_j] = (vectorOfReferrables(_j) != null ? vectorOfReferrables(_j).unpack() : null);}
|
||||
_o.setVectorOfReferrables(_oVectorOfReferrables);
|
||||
long _oSingleWeakReference = singleWeakReference();
|
||||
_o.setSingleWeakReference(_oSingleWeakReference);
|
||||
long[] _oVectorOfWeakReferences = new long[vectorOfWeakReferencesLength()];
|
||||
for (int _j = 0; _j < vectorOfWeakReferencesLength(); ++_j) {_oVectorOfWeakReferences[_j] = vectorOfWeakReferences(_j);}
|
||||
_o.setVectorOfWeakReferences(_oVectorOfWeakReferences);
|
||||
MyGame.Example.ReferrableT[] _oVectorOfStrongReferrables = new MyGame.Example.ReferrableT[vectorOfStrongReferrablesLength()];
|
||||
for (int _j = 0; _j < vectorOfStrongReferrablesLength(); ++_j) {_oVectorOfStrongReferrables[_j] = (vectorOfStrongReferrables(_j) != null ? vectorOfStrongReferrables(_j).unpack() : null);}
|
||||
_o.setVectorOfStrongReferrables(_oVectorOfStrongReferrables);
|
||||
long _oCoOwningReference = coOwningReference();
|
||||
_o.setCoOwningReference(_oCoOwningReference);
|
||||
long[] _oVectorOfCoOwningReferences = new long[vectorOfCoOwningReferencesLength()];
|
||||
for (int _j = 0; _j < vectorOfCoOwningReferencesLength(); ++_j) {_oVectorOfCoOwningReferences[_j] = vectorOfCoOwningReferences(_j);}
|
||||
_o.setVectorOfCoOwningReferences(_oVectorOfCoOwningReferences);
|
||||
long _oNonOwningReference = nonOwningReference();
|
||||
_o.setNonOwningReference(_oNonOwningReference);
|
||||
long[] _oVectorOfNonOwningReferences = new long[vectorOfNonOwningReferencesLength()];
|
||||
for (int _j = 0; _j < vectorOfNonOwningReferencesLength(); ++_j) {_oVectorOfNonOwningReferences[_j] = vectorOfNonOwningReferences(_j);}
|
||||
_o.setVectorOfNonOwningReferences(_oVectorOfNonOwningReferences);
|
||||
MyGame.Example.AnyUniqueAliasesUnion _oAnyUnique = new MyGame.Example.AnyUniqueAliasesUnion();
|
||||
byte _oAnyUniqueType = anyUniqueType();
|
||||
_oAnyUnique.setType(_oAnyUniqueType);
|
||||
Table _oAnyUniqueValue;
|
||||
switch (_oAnyUniqueType) {
|
||||
case MyGame.Example.AnyUniqueAliases.M:
|
||||
_oAnyUniqueValue = anyUnique(new MyGame.Example.Monster());
|
||||
_oAnyUnique.setValue(_oAnyUniqueValue != null ? ((MyGame.Example.Monster) _oAnyUniqueValue).unpack() : null);
|
||||
break;
|
||||
case MyGame.Example.AnyUniqueAliases.TS:
|
||||
_oAnyUniqueValue = anyUnique(new MyGame.Example.TestSimpleTableWithEnum());
|
||||
_oAnyUnique.setValue(_oAnyUniqueValue != null ? ((MyGame.Example.TestSimpleTableWithEnum) _oAnyUniqueValue).unpack() : null);
|
||||
break;
|
||||
case MyGame.Example.AnyUniqueAliases.M2:
|
||||
_oAnyUniqueValue = anyUnique(new MyGame.Example2.Monster());
|
||||
_oAnyUnique.setValue(_oAnyUniqueValue != null ? ((MyGame.Example2.Monster) _oAnyUniqueValue).unpack() : null);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
_o.setAnyUnique(_oAnyUnique);
|
||||
MyGame.Example.AnyAmbiguousAliasesUnion _oAnyAmbiguous = new MyGame.Example.AnyAmbiguousAliasesUnion();
|
||||
byte _oAnyAmbiguousType = anyAmbiguousType();
|
||||
_oAnyAmbiguous.setType(_oAnyAmbiguousType);
|
||||
Table _oAnyAmbiguousValue;
|
||||
switch (_oAnyAmbiguousType) {
|
||||
case MyGame.Example.AnyAmbiguousAliases.M1:
|
||||
_oAnyAmbiguousValue = anyAmbiguous(new MyGame.Example.Monster());
|
||||
_oAnyAmbiguous.setValue(_oAnyAmbiguousValue != null ? ((MyGame.Example.Monster) _oAnyAmbiguousValue).unpack() : null);
|
||||
break;
|
||||
case MyGame.Example.AnyAmbiguousAliases.M2:
|
||||
_oAnyAmbiguousValue = anyAmbiguous(new MyGame.Example.Monster());
|
||||
_oAnyAmbiguous.setValue(_oAnyAmbiguousValue != null ? ((MyGame.Example.Monster) _oAnyAmbiguousValue).unpack() : null);
|
||||
break;
|
||||
case MyGame.Example.AnyAmbiguousAliases.M3:
|
||||
_oAnyAmbiguousValue = anyAmbiguous(new MyGame.Example.Monster());
|
||||
_oAnyAmbiguous.setValue(_oAnyAmbiguousValue != null ? ((MyGame.Example.Monster) _oAnyAmbiguousValue).unpack() : null);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
_o.setAnyAmbiguous(_oAnyAmbiguous);
|
||||
int[] _oVectorOfEnums = new int[vectorOfEnumsLength()];
|
||||
for (int _j = 0; _j < vectorOfEnumsLength(); ++_j) {_oVectorOfEnums[_j] = vectorOfEnums(_j);}
|
||||
_o.setVectorOfEnums(_oVectorOfEnums);
|
||||
byte _oSignedEnum = signedEnum();
|
||||
_o.setSignedEnum(_oSignedEnum);
|
||||
int[] _oTestrequirednestedflatbuffer = new int[testrequirednestedflatbufferLength()];
|
||||
for (int _j = 0; _j < testrequirednestedflatbufferLength(); ++_j) {_oTestrequirednestedflatbuffer[_j] = testrequirednestedflatbuffer(_j);}
|
||||
_o.setTestrequirednestedflatbuffer(_oTestrequirednestedflatbuffer);
|
||||
MyGame.Example.StatT[] _oScalarKeySortedTables = new MyGame.Example.StatT[scalarKeySortedTablesLength()];
|
||||
for (int _j = 0; _j < scalarKeySortedTablesLength(); ++_j) {_oScalarKeySortedTables[_j] = (scalarKeySortedTables(_j) != null ? scalarKeySortedTables(_j).unpack() : null);}
|
||||
_o.setScalarKeySortedTables(_oScalarKeySortedTables);
|
||||
if (nativeInline() != null) nativeInline().unpackTo(_o.getNativeInline());
|
||||
else _o.setNativeInline(null);
|
||||
long _oLongEnumNonEnumDefault = longEnumNonEnumDefault();
|
||||
_o.setLongEnumNonEnumDefault(_oLongEnumNonEnumDefault);
|
||||
long _oLongEnumNormalDefault = longEnumNormalDefault();
|
||||
_o.setLongEnumNormalDefault(_oLongEnumNormalDefault);
|
||||
float _oNanDefault = nanDefault();
|
||||
_o.setNanDefault(_oNanDefault);
|
||||
float _oInfDefault = infDefault();
|
||||
_o.setInfDefault(_oInfDefault);
|
||||
float _oPositiveInfDefault = positiveInfDefault();
|
||||
_o.setPositiveInfDefault(_oPositiveInfDefault);
|
||||
float _oInfinityDefault = infinityDefault();
|
||||
_o.setInfinityDefault(_oInfinityDefault);
|
||||
float _oPositiveInfinityDefault = positiveInfinityDefault();
|
||||
_o.setPositiveInfinityDefault(_oPositiveInfinityDefault);
|
||||
float _oNegativeInfDefault = negativeInfDefault();
|
||||
_o.setNegativeInfDefault(_oNegativeInfDefault);
|
||||
float _oNegativeInfinityDefault = negativeInfinityDefault();
|
||||
_o.setNegativeInfinityDefault(_oNegativeInfinityDefault);
|
||||
double _oDoubleInfDefault = doubleInfDefault();
|
||||
_o.setDoubleInfDefault(_oDoubleInfDefault);
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, MonsterT _o) {
|
||||
if (_o == null) return 0;
|
||||
int _name = _o.getName() == null ? 0 : builder.createString(_o.getName());
|
||||
int _inventory = 0;
|
||||
if (_o.getInventory() != null) {
|
||||
byte[] __inventory = new byte[_o.getInventory().length];
|
||||
int _j = 0;
|
||||
for (int _e : _o.getInventory()) { __inventory[_j] = (byte) _e; _j++;}
|
||||
_inventory = createInventoryVector(builder, __inventory);
|
||||
}
|
||||
byte _testType = _o.getTest() == null ? MyGame.Example.Any.NONE : _o.getTest().getType();
|
||||
int _test = _o.getTest() == null ? 0 : MyGame.Example.AnyUnion.pack(builder, _o.getTest());
|
||||
int _test4 = 0;
|
||||
MyGame.Example.TestT[] _oTest4 = _o.getTest4();
|
||||
if (_oTest4 != null) {
|
||||
int _unused_offset = 0;
|
||||
startTest4Vector(builder, _oTest4.length);
|
||||
for (int _j = _oTest4.length - 1; _j >=0; _j--) { _unused_offset = MyGame.Example.Test.pack(builder, _oTest4[_j]);}
|
||||
_test4 = builder.endVector();
|
||||
}
|
||||
int _testarrayofstring = 0;
|
||||
if (_o.getTestarrayofstring() != null) {
|
||||
int[] __testarrayofstring = new int[_o.getTestarrayofstring().length];
|
||||
int _j = 0;
|
||||
for (String _e : _o.getTestarrayofstring()) { __testarrayofstring[_j] = builder.createString(_e); _j++;}
|
||||
_testarrayofstring = createTestarrayofstringVector(builder, __testarrayofstring);
|
||||
}
|
||||
int _testarrayoftables = 0;
|
||||
if (_o.getTestarrayoftables() != null) {
|
||||
int[] __testarrayoftables = new int[_o.getTestarrayoftables().length];
|
||||
int _j = 0;
|
||||
for (MyGame.Example.MonsterT _e : _o.getTestarrayoftables()) { __testarrayoftables[_j] = MyGame.Example.Monster.pack(builder, _e); _j++;}
|
||||
_testarrayoftables = createTestarrayoftablesVector(builder, __testarrayoftables);
|
||||
}
|
||||
int _enemy = _o.getEnemy() == null ? 0 : MyGame.Example.Monster.pack(builder, _o.getEnemy());
|
||||
int _testnestedflatbuffer = 0;
|
||||
if (_o.getTestnestedflatbuffer() != null) {
|
||||
byte[] __testnestedflatbuffer = new byte[_o.getTestnestedflatbuffer().length];
|
||||
int _j = 0;
|
||||
for (int _e : _o.getTestnestedflatbuffer()) { __testnestedflatbuffer[_j] = (byte) _e; _j++;}
|
||||
_testnestedflatbuffer = createTestnestedflatbufferVector(builder, __testnestedflatbuffer);
|
||||
}
|
||||
int _testempty = _o.getTestempty() == null ? 0 : MyGame.Example.Stat.pack(builder, _o.getTestempty());
|
||||
int _testarrayofbools = 0;
|
||||
if (_o.getTestarrayofbools() != null) {
|
||||
_testarrayofbools = createTestarrayofboolsVector(builder, _o.getTestarrayofbools());
|
||||
}
|
||||
int _testarrayofstring2 = 0;
|
||||
if (_o.getTestarrayofstring2() != null) {
|
||||
int[] __testarrayofstring2 = new int[_o.getTestarrayofstring2().length];
|
||||
int _j = 0;
|
||||
for (String _e : _o.getTestarrayofstring2()) { __testarrayofstring2[_j] = builder.createString(_e); _j++;}
|
||||
_testarrayofstring2 = createTestarrayofstring2Vector(builder, __testarrayofstring2);
|
||||
}
|
||||
int _testarrayofsortedstruct = 0;
|
||||
MyGame.Example.AbilityT[] _oTestarrayofsortedstruct = _o.getTestarrayofsortedstruct();
|
||||
if (_oTestarrayofsortedstruct != null) {
|
||||
int _unused_offset = 0;
|
||||
startTestarrayofsortedstructVector(builder, _oTestarrayofsortedstruct.length);
|
||||
for (int _j = _oTestarrayofsortedstruct.length - 1; _j >=0; _j--) { _unused_offset = MyGame.Example.Ability.pack(builder, _oTestarrayofsortedstruct[_j]);}
|
||||
_testarrayofsortedstruct = builder.endVector();
|
||||
}
|
||||
int _flex = 0;
|
||||
if (_o.getFlex() != null) {
|
||||
byte[] __flex = new byte[_o.getFlex().length];
|
||||
int _j = 0;
|
||||
for (int _e : _o.getFlex()) { __flex[_j] = (byte) _e; _j++;}
|
||||
_flex = createFlexVector(builder, __flex);
|
||||
}
|
||||
int _test5 = 0;
|
||||
MyGame.Example.TestT[] _oTest5 = _o.getTest5();
|
||||
if (_oTest5 != null) {
|
||||
int _unused_offset = 0;
|
||||
startTest5Vector(builder, _oTest5.length);
|
||||
for (int _j = _oTest5.length - 1; _j >=0; _j--) { _unused_offset = MyGame.Example.Test.pack(builder, _oTest5[_j]);}
|
||||
_test5 = builder.endVector();
|
||||
}
|
||||
int _vectorOfLongs = 0;
|
||||
if (_o.getVectorOfLongs() != null) {
|
||||
_vectorOfLongs = createVectorOfLongsVector(builder, _o.getVectorOfLongs());
|
||||
}
|
||||
int _vectorOfDoubles = 0;
|
||||
if (_o.getVectorOfDoubles() != null) {
|
||||
_vectorOfDoubles = createVectorOfDoublesVector(builder, _o.getVectorOfDoubles());
|
||||
}
|
||||
int _parentNamespaceTest = _o.getParentNamespaceTest() == null ? 0 : MyGame.InParentNamespace.pack(builder, _o.getParentNamespaceTest());
|
||||
int _vectorOfReferrables = 0;
|
||||
if (_o.getVectorOfReferrables() != null) {
|
||||
int[] __vectorOfReferrables = new int[_o.getVectorOfReferrables().length];
|
||||
int _j = 0;
|
||||
for (MyGame.Example.ReferrableT _e : _o.getVectorOfReferrables()) { __vectorOfReferrables[_j] = MyGame.Example.Referrable.pack(builder, _e); _j++;}
|
||||
_vectorOfReferrables = createVectorOfReferrablesVector(builder, __vectorOfReferrables);
|
||||
}
|
||||
int _vectorOfWeakReferences = 0;
|
||||
if (_o.getVectorOfWeakReferences() != null) {
|
||||
_vectorOfWeakReferences = createVectorOfWeakReferencesVector(builder, _o.getVectorOfWeakReferences());
|
||||
}
|
||||
int _vectorOfStrongReferrables = 0;
|
||||
if (_o.getVectorOfStrongReferrables() != null) {
|
||||
int[] __vectorOfStrongReferrables = new int[_o.getVectorOfStrongReferrables().length];
|
||||
int _j = 0;
|
||||
for (MyGame.Example.ReferrableT _e : _o.getVectorOfStrongReferrables()) { __vectorOfStrongReferrables[_j] = MyGame.Example.Referrable.pack(builder, _e); _j++;}
|
||||
_vectorOfStrongReferrables = createVectorOfStrongReferrablesVector(builder, __vectorOfStrongReferrables);
|
||||
}
|
||||
int _vectorOfCoOwningReferences = 0;
|
||||
if (_o.getVectorOfCoOwningReferences() != null) {
|
||||
_vectorOfCoOwningReferences = createVectorOfCoOwningReferencesVector(builder, _o.getVectorOfCoOwningReferences());
|
||||
}
|
||||
int _vectorOfNonOwningReferences = 0;
|
||||
if (_o.getVectorOfNonOwningReferences() != null) {
|
||||
_vectorOfNonOwningReferences = createVectorOfNonOwningReferencesVector(builder, _o.getVectorOfNonOwningReferences());
|
||||
}
|
||||
byte _anyUniqueType = _o.getAnyUnique() == null ? MyGame.Example.AnyUniqueAliases.NONE : _o.getAnyUnique().getType();
|
||||
int _anyUnique = _o.getAnyUnique() == null ? 0 : MyGame.Example.AnyUniqueAliasesUnion.pack(builder, _o.getAnyUnique());
|
||||
byte _anyAmbiguousType = _o.getAnyAmbiguous() == null ? MyGame.Example.AnyAmbiguousAliases.NONE : _o.getAnyAmbiguous().getType();
|
||||
int _anyAmbiguous = _o.getAnyAmbiguous() == null ? 0 : MyGame.Example.AnyAmbiguousAliasesUnion.pack(builder, _o.getAnyAmbiguous());
|
||||
int _vectorOfEnums = 0;
|
||||
if (_o.getVectorOfEnums() != null) {
|
||||
byte[] __vectorOfEnums = new byte[_o.getVectorOfEnums().length];
|
||||
int _j = 0;
|
||||
for (int _e : _o.getVectorOfEnums()) { __vectorOfEnums[_j] = (byte) _e; _j++;}
|
||||
_vectorOfEnums = createVectorOfEnumsVector(builder, __vectorOfEnums);
|
||||
}
|
||||
int _testrequirednestedflatbuffer = 0;
|
||||
if (_o.getTestrequirednestedflatbuffer() != null) {
|
||||
byte[] __testrequirednestedflatbuffer = new byte[_o.getTestrequirednestedflatbuffer().length];
|
||||
int _j = 0;
|
||||
for (int _e : _o.getTestrequirednestedflatbuffer()) { __testrequirednestedflatbuffer[_j] = (byte) _e; _j++;}
|
||||
_testrequirednestedflatbuffer = createTestrequirednestedflatbufferVector(builder, __testrequirednestedflatbuffer);
|
||||
}
|
||||
int _scalarKeySortedTables = 0;
|
||||
if (_o.getScalarKeySortedTables() != null) {
|
||||
int[] __scalarKeySortedTables = new int[_o.getScalarKeySortedTables().length];
|
||||
int _j = 0;
|
||||
for (MyGame.Example.StatT _e : _o.getScalarKeySortedTables()) { __scalarKeySortedTables[_j] = MyGame.Example.Stat.pack(builder, _e); _j++;}
|
||||
_scalarKeySortedTables = createScalarKeySortedTablesVector(builder, __scalarKeySortedTables);
|
||||
}
|
||||
startMonster(builder);
|
||||
addPos(builder, MyGame.Example.Vec3.pack(builder, _o.getPos()));
|
||||
addMana(builder, _o.getMana());
|
||||
addHp(builder, _o.getHp());
|
||||
addName(builder, _name);
|
||||
addInventory(builder, _inventory);
|
||||
addColor(builder, _o.getColor());
|
||||
addTestType(builder, _testType);
|
||||
addTest(builder, _test);
|
||||
addTest4(builder, _test4);
|
||||
addTestarrayofstring(builder, _testarrayofstring);
|
||||
addTestarrayoftables(builder, _testarrayoftables);
|
||||
addEnemy(builder, _enemy);
|
||||
addTestnestedflatbuffer(builder, _testnestedflatbuffer);
|
||||
addTestempty(builder, _testempty);
|
||||
addTestbool(builder, _o.getTestbool());
|
||||
addTesthashs32Fnv1(builder, _o.getTesthashs32Fnv1());
|
||||
addTesthashu32Fnv1(builder, _o.getTesthashu32Fnv1());
|
||||
addTesthashs64Fnv1(builder, _o.getTesthashs64Fnv1());
|
||||
addTesthashu64Fnv1(builder, _o.getTesthashu64Fnv1());
|
||||
addTesthashs32Fnv1a(builder, _o.getTesthashs32Fnv1a());
|
||||
addTesthashu32Fnv1a(builder, _o.getTesthashu32Fnv1a());
|
||||
addTesthashs64Fnv1a(builder, _o.getTesthashs64Fnv1a());
|
||||
addTesthashu64Fnv1a(builder, _o.getTesthashu64Fnv1a());
|
||||
addTestarrayofbools(builder, _testarrayofbools);
|
||||
addTestf(builder, _o.getTestf());
|
||||
addTestf2(builder, _o.getTestf2());
|
||||
addTestf3(builder, _o.getTestf3());
|
||||
addTestarrayofstring2(builder, _testarrayofstring2);
|
||||
addTestarrayofsortedstruct(builder, _testarrayofsortedstruct);
|
||||
addFlex(builder, _flex);
|
||||
addTest5(builder, _test5);
|
||||
addVectorOfLongs(builder, _vectorOfLongs);
|
||||
addVectorOfDoubles(builder, _vectorOfDoubles);
|
||||
addParentNamespaceTest(builder, _parentNamespaceTest);
|
||||
addVectorOfReferrables(builder, _vectorOfReferrables);
|
||||
addSingleWeakReference(builder, _o.getSingleWeakReference());
|
||||
addVectorOfWeakReferences(builder, _vectorOfWeakReferences);
|
||||
addVectorOfStrongReferrables(builder, _vectorOfStrongReferrables);
|
||||
addCoOwningReference(builder, _o.getCoOwningReference());
|
||||
addVectorOfCoOwningReferences(builder, _vectorOfCoOwningReferences);
|
||||
addNonOwningReference(builder, _o.getNonOwningReference());
|
||||
addVectorOfNonOwningReferences(builder, _vectorOfNonOwningReferences);
|
||||
addAnyUniqueType(builder, _anyUniqueType);
|
||||
addAnyUnique(builder, _anyUnique);
|
||||
addAnyAmbiguousType(builder, _anyAmbiguousType);
|
||||
addAnyAmbiguous(builder, _anyAmbiguous);
|
||||
addVectorOfEnums(builder, _vectorOfEnums);
|
||||
addSignedEnum(builder, _o.getSignedEnum());
|
||||
addTestrequirednestedflatbuffer(builder, _testrequirednestedflatbuffer);
|
||||
addScalarKeySortedTables(builder, _scalarKeySortedTables);
|
||||
addNativeInline(builder, MyGame.Example.Test.pack(builder, _o.getNativeInline()));
|
||||
addLongEnumNonEnumDefault(builder, _o.getLongEnumNonEnumDefault());
|
||||
addLongEnumNormalDefault(builder, _o.getLongEnumNormalDefault());
|
||||
addNanDefault(builder, _o.getNanDefault());
|
||||
addInfDefault(builder, _o.getInfDefault());
|
||||
addPositiveInfDefault(builder, _o.getPositiveInfDefault());
|
||||
addInfinityDefault(builder, _o.getInfinityDefault());
|
||||
addPositiveInfinityDefault(builder, _o.getPositiveInfinityDefault());
|
||||
addNegativeInfDefault(builder, _o.getNegativeInfDefault());
|
||||
addNegativeInfinityDefault(builder, _o.getNegativeInfinityDefault());
|
||||
addDoubleInfDefault(builder, _o.getDoubleInfDefault());
|
||||
return endMonster(builder);
|
||||
}
|
||||
}
|
||||
|
||||
+1254
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,734 @@
|
||||
#[ MyGame.Example.Monster
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by :
|
||||
Rooting type : MyGame.Example.Monster ()
|
||||
]#
|
||||
|
||||
import ../InParentNamespace as MyGame_InParentNamespace
|
||||
import Ability as MyGame_Example_Ability
|
||||
import Any as MyGame_Example_Any
|
||||
import AnyAmbiguousAliases as MyGame_Example_AnyAmbiguousAliases
|
||||
import AnyUniqueAliases as MyGame_Example_AnyUniqueAliases
|
||||
import Color as MyGame_Example_Color
|
||||
import LongEnum as MyGame_Example_LongEnum
|
||||
import Race as MyGame_Example_Race
|
||||
import Referrable as MyGame_Example_Referrable
|
||||
import Stat as MyGame_Example_Stat
|
||||
import Test as MyGame_Example_Test
|
||||
import Vec3 as MyGame_Example_Vec3
|
||||
import flatbuffers
|
||||
import std/options
|
||||
|
||||
# an example documentation comment: "monster object"
|
||||
type Monster* = object of FlatObj
|
||||
func pos*(self: Monster): Option[MyGame_Example_Vec3.Vec3] =
|
||||
let o = self.tab.Offset(4)
|
||||
if o != 0:
|
||||
return some(MyGame_Example_Vec3.Vec3(tab: Vtable(Bytes: self.tab.Bytes, Pos: self.tab.Pos + o)))
|
||||
func mana*(self: Monster): int16 =
|
||||
let o = self.tab.Offset(6)
|
||||
if o != 0:
|
||||
return Get[int16](self.tab, self.tab.Pos + o)
|
||||
return 150
|
||||
func `mana=`*(self: var Monster, n: int16): bool =
|
||||
return self.tab.MutateSlot(6, n)
|
||||
func hp*(self: Monster): int16 =
|
||||
let o = self.tab.Offset(8)
|
||||
if o != 0:
|
||||
return Get[int16](self.tab, self.tab.Pos + o)
|
||||
return 100
|
||||
func `hp=`*(self: var Monster, n: int16): bool =
|
||||
return self.tab.MutateSlot(8, n)
|
||||
func name*(self: Monster): string =
|
||||
let o = self.tab.Offset(10)
|
||||
if o != 0:
|
||||
return self.tab.String(self.tab.Pos + o)
|
||||
return ""
|
||||
func inventoryLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(14)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func inventory*(self: Monster, j: int): uint8 =
|
||||
let o = self.tab.Offset(14)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 1.uoffset
|
||||
return Get[uint8](self.tab, x)
|
||||
func inventory*(self: Monster): seq[uint8] =
|
||||
let len = self.inventoryLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.inventory(i))
|
||||
func color*(self: Monster): MyGame_Example_Color.Color =
|
||||
let o = self.tab.Offset(16)
|
||||
if o != 0:
|
||||
return MyGame_Example_Color.Color(Get[uint8](self.tab, self.tab.Pos + o))
|
||||
return type(result)(8)
|
||||
func `color=`*(self: var Monster, n: MyGame_Example_Color.Color): bool =
|
||||
return self.tab.MutateSlot(16, n)
|
||||
func testType*(self: Monster): MyGame_Example_Any.Any =
|
||||
let o = self.tab.Offset(18)
|
||||
if o != 0:
|
||||
return MyGame_Example_Any.Any(Get[uint8](self.tab, self.tab.Pos + o))
|
||||
return type(result)(0)
|
||||
func `testType=`*(self: var Monster, n: MyGame_Example_Any.Any): bool =
|
||||
return self.tab.MutateSlot(18, n)
|
||||
func test*(self: Monster): Option[Vtable] =
|
||||
let o = self.tab.Offset(20)
|
||||
if o != 0:
|
||||
return some(self.tab.Union(o))
|
||||
func test4Length*(self: Monster): int =
|
||||
let o = self.tab.Offset(22)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func test4*(self: Monster, j: int): MyGame_Example_Test.Test =
|
||||
let o = self.tab.Offset(22)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 4.uoffset
|
||||
return MyGame_Example_Test.Test(tab: Vtable(Bytes: self.tab.Bytes, Pos: x))
|
||||
func test4*(self: Monster): seq[MyGame_Example_Test.Test] =
|
||||
let len = self.test4Length
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.test4(i))
|
||||
func testarrayofstringLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(24)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func testarrayofstring*(self: Monster, j: int): string =
|
||||
let o = self.tab.Offset(24)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 4.uoffset
|
||||
return self.tab.String(x)
|
||||
func testarrayofstring*(self: Monster): seq[string] =
|
||||
let len = self.testarrayofstringLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.testarrayofstring(i))
|
||||
func testarrayoftablesLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(26)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func testarrayoftables*(self: Monster, j: int): Monster =
|
||||
let o = self.tab.Offset(26)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 4.uoffset
|
||||
return Monster(tab: Vtable(Bytes: self.tab.Bytes, Pos: x))
|
||||
func testarrayoftables*(self: Monster): seq[Monster] =
|
||||
let len = self.testarrayoftablesLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.testarrayoftables(i))
|
||||
func enemy*(self: Monster): Option[Monster] =
|
||||
let o = self.tab.Offset(28)
|
||||
if o != 0:
|
||||
return some(Monster(tab: Vtable(Bytes: self.tab.Bytes, Pos: self.tab.Pos + o)))
|
||||
func testnestedflatbufferLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(30)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func testnestedflatbuffer*(self: Monster, j: int): uint8 =
|
||||
let o = self.tab.Offset(30)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 1.uoffset
|
||||
return Get[uint8](self.tab, x)
|
||||
func testnestedflatbuffer*(self: Monster): seq[uint8] =
|
||||
let len = self.testnestedflatbufferLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.testnestedflatbuffer(i))
|
||||
func testempty*(self: Monster): Option[MyGame_Example_Stat.Stat] =
|
||||
let o = self.tab.Offset(32)
|
||||
if o != 0:
|
||||
return some(MyGame_Example_Stat.Stat(tab: Vtable(Bytes: self.tab.Bytes, Pos: self.tab.Pos + o)))
|
||||
func testbool*(self: Monster): bool =
|
||||
let o = self.tab.Offset(34)
|
||||
if o != 0:
|
||||
return Get[bool](self.tab, self.tab.Pos + o)
|
||||
return false
|
||||
func `testbool=`*(self: var Monster, n: bool): bool =
|
||||
return self.tab.MutateSlot(34, n)
|
||||
func testhashs32Fnv1*(self: Monster): int32 =
|
||||
let o = self.tab.Offset(36)
|
||||
if o != 0:
|
||||
return Get[int32](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `testhashs32Fnv1=`*(self: var Monster, n: int32): bool =
|
||||
return self.tab.MutateSlot(36, n)
|
||||
func testhashu32Fnv1*(self: Monster): uint32 =
|
||||
let o = self.tab.Offset(38)
|
||||
if o != 0:
|
||||
return Get[uint32](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `testhashu32Fnv1=`*(self: var Monster, n: uint32): bool =
|
||||
return self.tab.MutateSlot(38, n)
|
||||
func testhashs64Fnv1*(self: Monster): int64 =
|
||||
let o = self.tab.Offset(40)
|
||||
if o != 0:
|
||||
return Get[int64](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `testhashs64Fnv1=`*(self: var Monster, n: int64): bool =
|
||||
return self.tab.MutateSlot(40, n)
|
||||
func testhashu64Fnv1*(self: Monster): uint64 =
|
||||
let o = self.tab.Offset(42)
|
||||
if o != 0:
|
||||
return Get[uint64](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `testhashu64Fnv1=`*(self: var Monster, n: uint64): bool =
|
||||
return self.tab.MutateSlot(42, n)
|
||||
func testhashs32Fnv1a*(self: Monster): int32 =
|
||||
let o = self.tab.Offset(44)
|
||||
if o != 0:
|
||||
return Get[int32](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `testhashs32Fnv1a=`*(self: var Monster, n: int32): bool =
|
||||
return self.tab.MutateSlot(44, n)
|
||||
func testhashu32Fnv1a*(self: Monster): uint32 =
|
||||
let o = self.tab.Offset(46)
|
||||
if o != 0:
|
||||
return Get[uint32](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `testhashu32Fnv1a=`*(self: var Monster, n: uint32): bool =
|
||||
return self.tab.MutateSlot(46, n)
|
||||
func testhashs64Fnv1a*(self: Monster): int64 =
|
||||
let o = self.tab.Offset(48)
|
||||
if o != 0:
|
||||
return Get[int64](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `testhashs64Fnv1a=`*(self: var Monster, n: int64): bool =
|
||||
return self.tab.MutateSlot(48, n)
|
||||
func testhashu64Fnv1a*(self: Monster): uint64 =
|
||||
let o = self.tab.Offset(50)
|
||||
if o != 0:
|
||||
return Get[uint64](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `testhashu64Fnv1a=`*(self: var Monster, n: uint64): bool =
|
||||
return self.tab.MutateSlot(50, n)
|
||||
func testarrayofboolsLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(52)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func testarrayofbools*(self: Monster, j: int): bool =
|
||||
let o = self.tab.Offset(52)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 1.uoffset
|
||||
return Get[bool](self.tab, x)
|
||||
func testarrayofbools*(self: Monster): seq[bool] =
|
||||
let len = self.testarrayofboolsLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.testarrayofbools(i))
|
||||
func testf*(self: Monster): float32 =
|
||||
let o = self.tab.Offset(54)
|
||||
if o != 0:
|
||||
return Get[float32](self.tab, self.tab.Pos + o)
|
||||
return 3.14159
|
||||
func `testf=`*(self: var Monster, n: float32): bool =
|
||||
return self.tab.MutateSlot(54, n)
|
||||
func testf2*(self: Monster): float32 =
|
||||
let o = self.tab.Offset(56)
|
||||
if o != 0:
|
||||
return Get[float32](self.tab, self.tab.Pos + o)
|
||||
return 3.0
|
||||
func `testf2=`*(self: var Monster, n: float32): bool =
|
||||
return self.tab.MutateSlot(56, n)
|
||||
func testf3*(self: Monster): float32 =
|
||||
let o = self.tab.Offset(58)
|
||||
if o != 0:
|
||||
return Get[float32](self.tab, self.tab.Pos + o)
|
||||
return 0.0
|
||||
func `testf3=`*(self: var Monster, n: float32): bool =
|
||||
return self.tab.MutateSlot(58, n)
|
||||
func testarrayofstring2Length*(self: Monster): int =
|
||||
let o = self.tab.Offset(60)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func testarrayofstring2*(self: Monster, j: int): string =
|
||||
let o = self.tab.Offset(60)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 4.uoffset
|
||||
return self.tab.String(x)
|
||||
func testarrayofstring2*(self: Monster): seq[string] =
|
||||
let len = self.testarrayofstring2Length
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.testarrayofstring2(i))
|
||||
func testarrayofsortedstructLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(62)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func testarrayofsortedstruct*(self: Monster, j: int): MyGame_Example_Ability.Ability =
|
||||
let o = self.tab.Offset(62)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 8.uoffset
|
||||
return MyGame_Example_Ability.Ability(tab: Vtable(Bytes: self.tab.Bytes, Pos: x))
|
||||
func testarrayofsortedstruct*(self: Monster): seq[MyGame_Example_Ability.Ability] =
|
||||
let len = self.testarrayofsortedstructLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.testarrayofsortedstruct(i))
|
||||
func flexLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(64)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func flex*(self: Monster, j: int): uint8 =
|
||||
let o = self.tab.Offset(64)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 1.uoffset
|
||||
return Get[uint8](self.tab, x)
|
||||
func flex*(self: Monster): seq[uint8] =
|
||||
let len = self.flexLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.flex(i))
|
||||
func test5Length*(self: Monster): int =
|
||||
let o = self.tab.Offset(66)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func test5*(self: Monster, j: int): MyGame_Example_Test.Test =
|
||||
let o = self.tab.Offset(66)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 4.uoffset
|
||||
return MyGame_Example_Test.Test(tab: Vtable(Bytes: self.tab.Bytes, Pos: x))
|
||||
func test5*(self: Monster): seq[MyGame_Example_Test.Test] =
|
||||
let len = self.test5Length
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.test5(i))
|
||||
func vectorOfLongsLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(68)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func vectorOfLongs*(self: Monster, j: int): int64 =
|
||||
let o = self.tab.Offset(68)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 8.uoffset
|
||||
return Get[int64](self.tab, x)
|
||||
func vectorOfLongs*(self: Monster): seq[int64] =
|
||||
let len = self.vectorOfLongsLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.vectorOfLongs(i))
|
||||
func vectorOfDoublesLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(70)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func vectorOfDoubles*(self: Monster, j: int): float64 =
|
||||
let o = self.tab.Offset(70)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 8.uoffset
|
||||
return Get[float64](self.tab, x)
|
||||
func vectorOfDoubles*(self: Monster): seq[float64] =
|
||||
let len = self.vectorOfDoublesLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.vectorOfDoubles(i))
|
||||
func parentNamespaceTest*(self: Monster): Option[MyGame_InParentNamespace.InParentNamespace] =
|
||||
let o = self.tab.Offset(72)
|
||||
if o != 0:
|
||||
return some(MyGame_InParentNamespace.InParentNamespace(tab: Vtable(Bytes: self.tab.Bytes, Pos: self.tab.Pos + o)))
|
||||
func vectorOfReferrablesLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(74)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func vectorOfReferrables*(self: Monster, j: int): MyGame_Example_Referrable.Referrable =
|
||||
let o = self.tab.Offset(74)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 4.uoffset
|
||||
return MyGame_Example_Referrable.Referrable(tab: Vtable(Bytes: self.tab.Bytes, Pos: x))
|
||||
func vectorOfReferrables*(self: Monster): seq[MyGame_Example_Referrable.Referrable] =
|
||||
let len = self.vectorOfReferrablesLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.vectorOfReferrables(i))
|
||||
func singleWeakReference*(self: Monster): uint64 =
|
||||
let o = self.tab.Offset(76)
|
||||
if o != 0:
|
||||
return Get[uint64](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `singleWeakReference=`*(self: var Monster, n: uint64): bool =
|
||||
return self.tab.MutateSlot(76, n)
|
||||
func vectorOfWeakReferencesLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(78)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func vectorOfWeakReferences*(self: Monster, j: int): uint64 =
|
||||
let o = self.tab.Offset(78)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 8.uoffset
|
||||
return Get[uint64](self.tab, x)
|
||||
func vectorOfWeakReferences*(self: Monster): seq[uint64] =
|
||||
let len = self.vectorOfWeakReferencesLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.vectorOfWeakReferences(i))
|
||||
func vectorOfStrongReferrablesLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(80)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func vectorOfStrongReferrables*(self: Monster, j: int): MyGame_Example_Referrable.Referrable =
|
||||
let o = self.tab.Offset(80)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 4.uoffset
|
||||
return MyGame_Example_Referrable.Referrable(tab: Vtable(Bytes: self.tab.Bytes, Pos: x))
|
||||
func vectorOfStrongReferrables*(self: Monster): seq[MyGame_Example_Referrable.Referrable] =
|
||||
let len = self.vectorOfStrongReferrablesLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.vectorOfStrongReferrables(i))
|
||||
func coOwningReference*(self: Monster): uint64 =
|
||||
let o = self.tab.Offset(82)
|
||||
if o != 0:
|
||||
return Get[uint64](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `coOwningReference=`*(self: var Monster, n: uint64): bool =
|
||||
return self.tab.MutateSlot(82, n)
|
||||
func vectorOfCoOwningReferencesLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(84)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func vectorOfCoOwningReferences*(self: Monster, j: int): uint64 =
|
||||
let o = self.tab.Offset(84)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 8.uoffset
|
||||
return Get[uint64](self.tab, x)
|
||||
func vectorOfCoOwningReferences*(self: Monster): seq[uint64] =
|
||||
let len = self.vectorOfCoOwningReferencesLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.vectorOfCoOwningReferences(i))
|
||||
func nonOwningReference*(self: Monster): uint64 =
|
||||
let o = self.tab.Offset(86)
|
||||
if o != 0:
|
||||
return Get[uint64](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `nonOwningReference=`*(self: var Monster, n: uint64): bool =
|
||||
return self.tab.MutateSlot(86, n)
|
||||
func vectorOfNonOwningReferencesLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(88)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func vectorOfNonOwningReferences*(self: Monster, j: int): uint64 =
|
||||
let o = self.tab.Offset(88)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 8.uoffset
|
||||
return Get[uint64](self.tab, x)
|
||||
func vectorOfNonOwningReferences*(self: Monster): seq[uint64] =
|
||||
let len = self.vectorOfNonOwningReferencesLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.vectorOfNonOwningReferences(i))
|
||||
func anyUniqueType*(self: Monster): MyGame_Example_AnyUniqueAliases.AnyUniqueAliases =
|
||||
let o = self.tab.Offset(90)
|
||||
if o != 0:
|
||||
return MyGame_Example_AnyUniqueAliases.AnyUniqueAliases(Get[uint8](self.tab, self.tab.Pos + o))
|
||||
return type(result)(0)
|
||||
func `anyUniqueType=`*(self: var Monster, n: MyGame_Example_AnyUniqueAliases.AnyUniqueAliases): bool =
|
||||
return self.tab.MutateSlot(90, n)
|
||||
func anyUnique*(self: Monster): Option[Vtable] =
|
||||
let o = self.tab.Offset(92)
|
||||
if o != 0:
|
||||
return some(self.tab.Union(o))
|
||||
func anyAmbiguousType*(self: Monster): MyGame_Example_AnyAmbiguousAliases.AnyAmbiguousAliases =
|
||||
let o = self.tab.Offset(94)
|
||||
if o != 0:
|
||||
return MyGame_Example_AnyAmbiguousAliases.AnyAmbiguousAliases(Get[uint8](self.tab, self.tab.Pos + o))
|
||||
return type(result)(0)
|
||||
func `anyAmbiguousType=`*(self: var Monster, n: MyGame_Example_AnyAmbiguousAliases.AnyAmbiguousAliases): bool =
|
||||
return self.tab.MutateSlot(94, n)
|
||||
func anyAmbiguous*(self: Monster): Option[Vtable] =
|
||||
let o = self.tab.Offset(96)
|
||||
if o != 0:
|
||||
return some(self.tab.Union(o))
|
||||
func vectorOfEnumsLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(98)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func vectorOfEnums*(self: Monster, j: int): MyGame_Example_Color.Color =
|
||||
let o = self.tab.Offset(98)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 1.uoffset
|
||||
return MyGame_Example_Color.Color(Get[uint8](self.tab, x))
|
||||
func vectorOfEnums*(self: Monster): seq[MyGame_Example_Color.Color] =
|
||||
let len = self.vectorOfEnumsLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.vectorOfEnums(i))
|
||||
func signedEnum*(self: Monster): MyGame_Example_Race.Race =
|
||||
let o = self.tab.Offset(100)
|
||||
if o != 0:
|
||||
return MyGame_Example_Race.Race(Get[int8](self.tab, self.tab.Pos + o))
|
||||
return type(result)(-1)
|
||||
func `signedEnum=`*(self: var Monster, n: MyGame_Example_Race.Race): bool =
|
||||
return self.tab.MutateSlot(100, n)
|
||||
func testrequirednestedflatbufferLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(102)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func testrequirednestedflatbuffer*(self: Monster, j: int): uint8 =
|
||||
let o = self.tab.Offset(102)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 1.uoffset
|
||||
return Get[uint8](self.tab, x)
|
||||
func testrequirednestedflatbuffer*(self: Monster): seq[uint8] =
|
||||
let len = self.testrequirednestedflatbufferLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.testrequirednestedflatbuffer(i))
|
||||
func scalarKeySortedTablesLength*(self: Monster): int =
|
||||
let o = self.tab.Offset(104)
|
||||
if o != 0:
|
||||
return self.tab.VectorLen(o)
|
||||
func scalarKeySortedTables*(self: Monster, j: int): MyGame_Example_Stat.Stat =
|
||||
let o = self.tab.Offset(104)
|
||||
if o != 0:
|
||||
var x = self.tab.Vector(o)
|
||||
x += j.uoffset * 4.uoffset
|
||||
return MyGame_Example_Stat.Stat(tab: Vtable(Bytes: self.tab.Bytes, Pos: x))
|
||||
func scalarKeySortedTables*(self: Monster): seq[MyGame_Example_Stat.Stat] =
|
||||
let len = self.scalarKeySortedTablesLength
|
||||
for i in countup(0, len - 1):
|
||||
result.add(self.scalarKeySortedTables(i))
|
||||
func nativeInline*(self: Monster): Option[MyGame_Example_Test.Test] =
|
||||
let o = self.tab.Offset(106)
|
||||
if o != 0:
|
||||
return some(MyGame_Example_Test.Test(tab: Vtable(Bytes: self.tab.Bytes, Pos: self.tab.Pos + o)))
|
||||
func longEnumNonEnumDefault*(self: Monster): MyGame_Example_LongEnum.LongEnum =
|
||||
let o = self.tab.Offset(108)
|
||||
if o != 0:
|
||||
return MyGame_Example_LongEnum.LongEnum(Get[uint64](self.tab, self.tab.Pos + o))
|
||||
return type(result)(0)
|
||||
func `longEnumNonEnumDefault=`*(self: var Monster, n: MyGame_Example_LongEnum.LongEnum): bool =
|
||||
return self.tab.MutateSlot(108, n)
|
||||
func longEnumNormalDefault*(self: Monster): MyGame_Example_LongEnum.LongEnum =
|
||||
let o = self.tab.Offset(110)
|
||||
if o != 0:
|
||||
return MyGame_Example_LongEnum.LongEnum(Get[uint64](self.tab, self.tab.Pos + o))
|
||||
return type(result)(2)
|
||||
func `longEnumNormalDefault=`*(self: var Monster, n: MyGame_Example_LongEnum.LongEnum): bool =
|
||||
return self.tab.MutateSlot(110, n)
|
||||
func nanDefault*(self: Monster): float32 =
|
||||
let o = self.tab.Offset(112)
|
||||
if o != 0:
|
||||
return Get[float32](self.tab, self.tab.Pos + o)
|
||||
return NaN
|
||||
func `nanDefault=`*(self: var Monster, n: float32): bool =
|
||||
return self.tab.MutateSlot(112, n)
|
||||
func infDefault*(self: Monster): float32 =
|
||||
let o = self.tab.Offset(114)
|
||||
if o != 0:
|
||||
return Get[float32](self.tab, self.tab.Pos + o)
|
||||
return Inf
|
||||
func `infDefault=`*(self: var Monster, n: float32): bool =
|
||||
return self.tab.MutateSlot(114, n)
|
||||
func positiveInfDefault*(self: Monster): float32 =
|
||||
let o = self.tab.Offset(116)
|
||||
if o != 0:
|
||||
return Get[float32](self.tab, self.tab.Pos + o)
|
||||
return Inf
|
||||
func `positiveInfDefault=`*(self: var Monster, n: float32): bool =
|
||||
return self.tab.MutateSlot(116, n)
|
||||
func infinityDefault*(self: Monster): float32 =
|
||||
let o = self.tab.Offset(118)
|
||||
if o != 0:
|
||||
return Get[float32](self.tab, self.tab.Pos + o)
|
||||
return Inf
|
||||
func `infinityDefault=`*(self: var Monster, n: float32): bool =
|
||||
return self.tab.MutateSlot(118, n)
|
||||
func positiveInfinityDefault*(self: Monster): float32 =
|
||||
let o = self.tab.Offset(120)
|
||||
if o != 0:
|
||||
return Get[float32](self.tab, self.tab.Pos + o)
|
||||
return Inf
|
||||
func `positiveInfinityDefault=`*(self: var Monster, n: float32): bool =
|
||||
return self.tab.MutateSlot(120, n)
|
||||
func negativeInfDefault*(self: Monster): float32 =
|
||||
let o = self.tab.Offset(122)
|
||||
if o != 0:
|
||||
return Get[float32](self.tab, self.tab.Pos + o)
|
||||
return -Inf
|
||||
func `negativeInfDefault=`*(self: var Monster, n: float32): bool =
|
||||
return self.tab.MutateSlot(122, n)
|
||||
func negativeInfinityDefault*(self: Monster): float32 =
|
||||
let o = self.tab.Offset(124)
|
||||
if o != 0:
|
||||
return Get[float32](self.tab, self.tab.Pos + o)
|
||||
return -Inf
|
||||
func `negativeInfinityDefault=`*(self: var Monster, n: float32): bool =
|
||||
return self.tab.MutateSlot(124, n)
|
||||
func doubleInfDefault*(self: Monster): float64 =
|
||||
let o = self.tab.Offset(126)
|
||||
if o != 0:
|
||||
return Get[float64](self.tab, self.tab.Pos + o)
|
||||
return Inf
|
||||
func `doubleInfDefault=`*(self: var Monster, n: float64): bool =
|
||||
return self.tab.MutateSlot(126, n)
|
||||
proc MonsterStart*(builder: var Builder) =
|
||||
builder.StartObject(62)
|
||||
proc MonsterAddpos*(builder: var Builder, pos: uoffset) =
|
||||
builder.PrependStructSlot(0, pos, default(uoffset))
|
||||
proc MonsterAddmana*(builder: var Builder, mana: int16) =
|
||||
builder.PrependSlot(1, mana, default(int16))
|
||||
proc MonsterAddhp*(builder: var Builder, hp: int16) =
|
||||
builder.PrependSlot(2, hp, default(int16))
|
||||
proc MonsterAddname*(builder: var Builder, name: uoffset) =
|
||||
builder.PrependSlot(3, name, default(uoffset))
|
||||
proc MonsterAddinventory*(builder: var Builder, inventory: uoffset) =
|
||||
builder.PrependSlot(5, inventory, default(uoffset))
|
||||
proc MonsterStartinventoryVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(1, numElems, 1)
|
||||
proc MonsterAddcolor*(builder: var Builder, color: uint8) =
|
||||
builder.PrependSlot(6, color, default(uint8))
|
||||
proc MonsterAddtestType*(builder: var Builder, testType: uint8) =
|
||||
builder.PrependSlot(7, testType, default(uint8))
|
||||
proc MonsterAddtest*(builder: var Builder, test: uoffset) =
|
||||
builder.PrependSlot(8, test, default(uoffset))
|
||||
proc MonsterAddtest4*(builder: var Builder, test4: uoffset) =
|
||||
builder.PrependSlot(9, test4, default(uoffset))
|
||||
proc MonsterStarttest4Vector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(4, numElems, 2)
|
||||
proc MonsterAddtestarrayofstring*(builder: var Builder, testarrayofstring: uoffset) =
|
||||
builder.PrependSlot(10, testarrayofstring, default(uoffset))
|
||||
proc MonsterStarttestarrayofstringVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(4, numElems, 4)
|
||||
proc MonsterAddtestarrayoftables*(builder: var Builder, testarrayoftables: uoffset) =
|
||||
builder.PrependSlot(11, testarrayoftables, default(uoffset))
|
||||
proc MonsterStarttestarrayoftablesVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(4, numElems, 4)
|
||||
proc MonsterAddenemy*(builder: var Builder, enemy: uoffset) =
|
||||
builder.PrependStructSlot(12, enemy, default(uoffset))
|
||||
proc MonsterAddtestnestedflatbuffer*(builder: var Builder, testnestedflatbuffer: uoffset) =
|
||||
builder.PrependSlot(13, testnestedflatbuffer, default(uoffset))
|
||||
proc MonsterStarttestnestedflatbufferVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(1, numElems, 1)
|
||||
proc MonsterAddtestempty*(builder: var Builder, testempty: uoffset) =
|
||||
builder.PrependStructSlot(14, testempty, default(uoffset))
|
||||
proc MonsterAddtestbool*(builder: var Builder, testbool: bool) =
|
||||
builder.PrependSlot(15, testbool, default(bool))
|
||||
proc MonsterAddtesthashs32Fnv1*(builder: var Builder, testhashs32Fnv1: int32) =
|
||||
builder.PrependSlot(16, testhashs32Fnv1, default(int32))
|
||||
proc MonsterAddtesthashu32Fnv1*(builder: var Builder, testhashu32Fnv1: uint32) =
|
||||
builder.PrependSlot(17, testhashu32Fnv1, default(uint32))
|
||||
proc MonsterAddtesthashs64Fnv1*(builder: var Builder, testhashs64Fnv1: int64) =
|
||||
builder.PrependSlot(18, testhashs64Fnv1, default(int64))
|
||||
proc MonsterAddtesthashu64Fnv1*(builder: var Builder, testhashu64Fnv1: uint64) =
|
||||
builder.PrependSlot(19, testhashu64Fnv1, default(uint64))
|
||||
proc MonsterAddtesthashs32Fnv1a*(builder: var Builder, testhashs32Fnv1a: int32) =
|
||||
builder.PrependSlot(20, testhashs32Fnv1a, default(int32))
|
||||
proc MonsterAddtesthashu32Fnv1a*(builder: var Builder, testhashu32Fnv1a: uint32) =
|
||||
builder.PrependSlot(21, testhashu32Fnv1a, default(uint32))
|
||||
proc MonsterAddtesthashs64Fnv1a*(builder: var Builder, testhashs64Fnv1a: int64) =
|
||||
builder.PrependSlot(22, testhashs64Fnv1a, default(int64))
|
||||
proc MonsterAddtesthashu64Fnv1a*(builder: var Builder, testhashu64Fnv1a: uint64) =
|
||||
builder.PrependSlot(23, testhashu64Fnv1a, default(uint64))
|
||||
proc MonsterAddtestarrayofbools*(builder: var Builder, testarrayofbools: uoffset) =
|
||||
builder.PrependSlot(24, testarrayofbools, default(uoffset))
|
||||
proc MonsterStarttestarrayofboolsVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(1, numElems, 1)
|
||||
proc MonsterAddtestf*(builder: var Builder, testf: float32) =
|
||||
builder.PrependSlot(25, testf, default(float32))
|
||||
proc MonsterAddtestf2*(builder: var Builder, testf2: float32) =
|
||||
builder.PrependSlot(26, testf2, default(float32))
|
||||
proc MonsterAddtestf3*(builder: var Builder, testf3: float32) =
|
||||
builder.PrependSlot(27, testf3, default(float32))
|
||||
proc MonsterAddtestarrayofstring2*(builder: var Builder, testarrayofstring2: uoffset) =
|
||||
builder.PrependSlot(28, testarrayofstring2, default(uoffset))
|
||||
proc MonsterStarttestarrayofstring2Vector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(4, numElems, 4)
|
||||
proc MonsterAddtestarrayofsortedstruct*(builder: var Builder, testarrayofsortedstruct: uoffset) =
|
||||
builder.PrependSlot(29, testarrayofsortedstruct, default(uoffset))
|
||||
proc MonsterStarttestarrayofsortedstructVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(8, numElems, 4)
|
||||
proc MonsterAddflex*(builder: var Builder, flex: uoffset) =
|
||||
builder.PrependSlot(30, flex, default(uoffset))
|
||||
proc MonsterStartflexVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(1, numElems, 1)
|
||||
proc MonsterAddtest5*(builder: var Builder, test5: uoffset) =
|
||||
builder.PrependSlot(31, test5, default(uoffset))
|
||||
proc MonsterStarttest5Vector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(4, numElems, 2)
|
||||
proc MonsterAddvectorOfLongs*(builder: var Builder, vectorOfLongs: uoffset) =
|
||||
builder.PrependSlot(32, vectorOfLongs, default(uoffset))
|
||||
proc MonsterStartvectorOfLongsVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(8, numElems, 8)
|
||||
proc MonsterAddvectorOfDoubles*(builder: var Builder, vectorOfDoubles: uoffset) =
|
||||
builder.PrependSlot(33, vectorOfDoubles, default(uoffset))
|
||||
proc MonsterStartvectorOfDoublesVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(8, numElems, 8)
|
||||
proc MonsterAddparentNamespaceTest*(builder: var Builder, parentNamespaceTest: uoffset) =
|
||||
builder.PrependStructSlot(34, parentNamespaceTest, default(uoffset))
|
||||
proc MonsterAddvectorOfReferrables*(builder: var Builder, vectorOfReferrables: uoffset) =
|
||||
builder.PrependSlot(35, vectorOfReferrables, default(uoffset))
|
||||
proc MonsterStartvectorOfReferrablesVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(4, numElems, 4)
|
||||
proc MonsterAddsingleWeakReference*(builder: var Builder, singleWeakReference: uint64) =
|
||||
builder.PrependSlot(36, singleWeakReference, default(uint64))
|
||||
proc MonsterAddvectorOfWeakReferences*(builder: var Builder, vectorOfWeakReferences: uoffset) =
|
||||
builder.PrependSlot(37, vectorOfWeakReferences, default(uoffset))
|
||||
proc MonsterStartvectorOfWeakReferencesVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(8, numElems, 8)
|
||||
proc MonsterAddvectorOfStrongReferrables*(builder: var Builder, vectorOfStrongReferrables: uoffset) =
|
||||
builder.PrependSlot(38, vectorOfStrongReferrables, default(uoffset))
|
||||
proc MonsterStartvectorOfStrongReferrablesVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(4, numElems, 4)
|
||||
proc MonsterAddcoOwningReference*(builder: var Builder, coOwningReference: uint64) =
|
||||
builder.PrependSlot(39, coOwningReference, default(uint64))
|
||||
proc MonsterAddvectorOfCoOwningReferences*(builder: var Builder, vectorOfCoOwningReferences: uoffset) =
|
||||
builder.PrependSlot(40, vectorOfCoOwningReferences, default(uoffset))
|
||||
proc MonsterStartvectorOfCoOwningReferencesVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(8, numElems, 8)
|
||||
proc MonsterAddnonOwningReference*(builder: var Builder, nonOwningReference: uint64) =
|
||||
builder.PrependSlot(41, nonOwningReference, default(uint64))
|
||||
proc MonsterAddvectorOfNonOwningReferences*(builder: var Builder, vectorOfNonOwningReferences: uoffset) =
|
||||
builder.PrependSlot(42, vectorOfNonOwningReferences, default(uoffset))
|
||||
proc MonsterStartvectorOfNonOwningReferencesVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(8, numElems, 8)
|
||||
proc MonsterAddanyUniqueType*(builder: var Builder, anyUniqueType: uint8) =
|
||||
builder.PrependSlot(43, anyUniqueType, default(uint8))
|
||||
proc MonsterAddanyUnique*(builder: var Builder, anyUnique: uoffset) =
|
||||
builder.PrependSlot(44, anyUnique, default(uoffset))
|
||||
proc MonsterAddanyAmbiguousType*(builder: var Builder, anyAmbiguousType: uint8) =
|
||||
builder.PrependSlot(45, anyAmbiguousType, default(uint8))
|
||||
proc MonsterAddanyAmbiguous*(builder: var Builder, anyAmbiguous: uoffset) =
|
||||
builder.PrependSlot(46, anyAmbiguous, default(uoffset))
|
||||
proc MonsterAddvectorOfEnums*(builder: var Builder, vectorOfEnums: uoffset) =
|
||||
builder.PrependSlot(47, vectorOfEnums, default(uoffset))
|
||||
proc MonsterStartvectorOfEnumsVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(1, numElems, 1)
|
||||
proc MonsterAddsignedEnum*(builder: var Builder, signedEnum: int8) =
|
||||
builder.PrependSlot(48, signedEnum, default(int8))
|
||||
proc MonsterAddtestrequirednestedflatbuffer*(builder: var Builder, testrequirednestedflatbuffer: uoffset) =
|
||||
builder.PrependSlot(49, testrequirednestedflatbuffer, default(uoffset))
|
||||
proc MonsterStarttestrequirednestedflatbufferVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(1, numElems, 1)
|
||||
proc MonsterAddscalarKeySortedTables*(builder: var Builder, scalarKeySortedTables: uoffset) =
|
||||
builder.PrependSlot(50, scalarKeySortedTables, default(uoffset))
|
||||
proc MonsterStartscalarKeySortedTablesVector*(builder: var Builder, numElems: uoffset) =
|
||||
builder.StartVector(4, numElems, 4)
|
||||
proc MonsterAddnativeInline*(builder: var Builder, nativeInline: uoffset) =
|
||||
builder.PrependStructSlot(51, nativeInline, default(uoffset))
|
||||
proc MonsterAddlongEnumNonEnumDefault*(builder: var Builder, longEnumNonEnumDefault: uint64) =
|
||||
builder.PrependSlot(52, longEnumNonEnumDefault, default(uint64))
|
||||
proc MonsterAddlongEnumNormalDefault*(builder: var Builder, longEnumNormalDefault: uint64) =
|
||||
builder.PrependSlot(53, longEnumNormalDefault, default(uint64))
|
||||
proc MonsterAddnanDefault*(builder: var Builder, nanDefault: float32) =
|
||||
builder.PrependSlot(54, nanDefault, default(float32))
|
||||
proc MonsterAddinfDefault*(builder: var Builder, infDefault: float32) =
|
||||
builder.PrependSlot(55, infDefault, default(float32))
|
||||
proc MonsterAddpositiveInfDefault*(builder: var Builder, positiveInfDefault: float32) =
|
||||
builder.PrependSlot(56, positiveInfDefault, default(float32))
|
||||
proc MonsterAddinfinityDefault*(builder: var Builder, infinityDefault: float32) =
|
||||
builder.PrependSlot(57, infinityDefault, default(float32))
|
||||
proc MonsterAddpositiveInfinityDefault*(builder: var Builder, positiveInfinityDefault: float32) =
|
||||
builder.PrependSlot(58, positiveInfinityDefault, default(float32))
|
||||
proc MonsterAddnegativeInfDefault*(builder: var Builder, negativeInfDefault: float32) =
|
||||
builder.PrependSlot(59, negativeInfDefault, default(float32))
|
||||
proc MonsterAddnegativeInfinityDefault*(builder: var Builder, negativeInfinityDefault: float32) =
|
||||
builder.PrependSlot(60, negativeInfinityDefault, default(float32))
|
||||
proc MonsterAdddoubleInfDefault*(builder: var Builder, doubleInfDefault: float64) =
|
||||
builder.PrependSlot(61, doubleInfDefault, default(float64))
|
||||
proc MonsterEnd*(builder: var Builder): uoffset =
|
||||
return builder.EndObject()
|
||||
File diff suppressed because it is too large
Load Diff
+1939
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,470 @@
|
||||
//Generated by flatc compiler (version 2.0.0)
|
||||
//If you make any local changes, they will be lost
|
||||
//source: monster_test.fbs
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.grpc.FlatbuffersUtils;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import static io.grpc.MethodDescriptor.generateFullMethodName;
|
||||
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
|
||||
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
|
||||
import static io.grpc.stub.ClientCalls.futureUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
||||
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
||||
|
||||
/**
|
||||
*/
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
comments = "Source: monster_test.fbs")
|
||||
public final class MonsterStorageGrpc {
|
||||
|
||||
private MonsterStorageGrpc() {}
|
||||
|
||||
public static final String SERVICE_NAME = "MyGame.Example.MonsterStorage";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||
@java.lang.Deprecated // Use {@link #getStoreMethod()} instead.
|
||||
public static final io.grpc.MethodDescriptor<MyGame.Example.Monster,
|
||||
MyGame.Example.Stat> METHOD_STORE = getStoreMethod();
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<MyGame.Example.Monster,
|
||||
MyGame.Example.Stat> getStoreMethod;
|
||||
|
||||
private static volatile FlatbuffersUtils.FBExtactor<MyGame.Example.Monster> extractorOfMonster;
|
||||
private static FlatbuffersUtils.FBExtactor<MyGame.Example.Monster> getExtractorOfMonster() {
|
||||
if (extractorOfMonster != null) return extractorOfMonster;
|
||||
synchronized (MonsterStorageGrpc.class) {
|
||||
if (extractorOfMonster != null) return extractorOfMonster;
|
||||
extractorOfMonster = new FlatbuffersUtils.FBExtactor<MyGame.Example.Monster>() {
|
||||
public MyGame.Example.Monster extract (ByteBuffer buffer) {
|
||||
return MyGame.Example.Monster.getRootAsMonster(buffer);
|
||||
}
|
||||
};
|
||||
return extractorOfMonster;
|
||||
}
|
||||
}
|
||||
|
||||
private static volatile FlatbuffersUtils.FBExtactor<MyGame.Example.Stat> extractorOfStat;
|
||||
private static FlatbuffersUtils.FBExtactor<MyGame.Example.Stat> getExtractorOfStat() {
|
||||
if (extractorOfStat != null) return extractorOfStat;
|
||||
synchronized (MonsterStorageGrpc.class) {
|
||||
if (extractorOfStat != null) return extractorOfStat;
|
||||
extractorOfStat = new FlatbuffersUtils.FBExtactor<MyGame.Example.Stat>() {
|
||||
public MyGame.Example.Stat extract (ByteBuffer buffer) {
|
||||
return MyGame.Example.Stat.getRootAsStat(buffer);
|
||||
}
|
||||
};
|
||||
return extractorOfStat;
|
||||
}
|
||||
}
|
||||
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||
public static io.grpc.MethodDescriptor<MyGame.Example.Monster,
|
||||
MyGame.Example.Stat> getStoreMethod() {
|
||||
io.grpc.MethodDescriptor<MyGame.Example.Monster, MyGame.Example.Stat> getStoreMethod;
|
||||
if ((getStoreMethod = MonsterStorageGrpc.getStoreMethod) == null) {
|
||||
synchronized (MonsterStorageGrpc.class) {
|
||||
if ((getStoreMethod = MonsterStorageGrpc.getStoreMethod) == null) {
|
||||
MonsterStorageGrpc.getStoreMethod = getStoreMethod =
|
||||
io.grpc.MethodDescriptor.<MyGame.Example.Monster, MyGame.Example.Stat>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(
|
||||
"MyGame.Example.MonsterStorage", "Store"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(FlatbuffersUtils.marshaller(
|
||||
MyGame.Example.Monster.class, getExtractorOfMonster()))
|
||||
.setResponseMarshaller(FlatbuffersUtils.marshaller(
|
||||
MyGame.Example.Stat.class, getExtractorOfStat()))
|
||||
.setSchemaDescriptor(null)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getStoreMethod;
|
||||
}
|
||||
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||
@java.lang.Deprecated // Use {@link #getRetrieveMethod()} instead.
|
||||
public static final io.grpc.MethodDescriptor<MyGame.Example.Stat,
|
||||
MyGame.Example.Monster> METHOD_RETRIEVE = getRetrieveMethod();
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<MyGame.Example.Stat,
|
||||
MyGame.Example.Monster> getRetrieveMethod;
|
||||
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||
public static io.grpc.MethodDescriptor<MyGame.Example.Stat,
|
||||
MyGame.Example.Monster> getRetrieveMethod() {
|
||||
io.grpc.MethodDescriptor<MyGame.Example.Stat, MyGame.Example.Monster> getRetrieveMethod;
|
||||
if ((getRetrieveMethod = MonsterStorageGrpc.getRetrieveMethod) == null) {
|
||||
synchronized (MonsterStorageGrpc.class) {
|
||||
if ((getRetrieveMethod = MonsterStorageGrpc.getRetrieveMethod) == null) {
|
||||
MonsterStorageGrpc.getRetrieveMethod = getRetrieveMethod =
|
||||
io.grpc.MethodDescriptor.<MyGame.Example.Stat, MyGame.Example.Monster>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
|
||||
.setFullMethodName(generateFullMethodName(
|
||||
"MyGame.Example.MonsterStorage", "Retrieve"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(FlatbuffersUtils.marshaller(
|
||||
MyGame.Example.Stat.class, getExtractorOfStat()))
|
||||
.setResponseMarshaller(FlatbuffersUtils.marshaller(
|
||||
MyGame.Example.Monster.class, getExtractorOfMonster()))
|
||||
.setSchemaDescriptor(null)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getRetrieveMethod;
|
||||
}
|
||||
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||
@java.lang.Deprecated // Use {@link #getGetMaxHitPointMethod()} instead.
|
||||
public static final io.grpc.MethodDescriptor<MyGame.Example.Monster,
|
||||
MyGame.Example.Stat> METHOD_GET_MAX_HIT_POINT = getGetMaxHitPointMethod();
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<MyGame.Example.Monster,
|
||||
MyGame.Example.Stat> getGetMaxHitPointMethod;
|
||||
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||
public static io.grpc.MethodDescriptor<MyGame.Example.Monster,
|
||||
MyGame.Example.Stat> getGetMaxHitPointMethod() {
|
||||
io.grpc.MethodDescriptor<MyGame.Example.Monster, MyGame.Example.Stat> getGetMaxHitPointMethod;
|
||||
if ((getGetMaxHitPointMethod = MonsterStorageGrpc.getGetMaxHitPointMethod) == null) {
|
||||
synchronized (MonsterStorageGrpc.class) {
|
||||
if ((getGetMaxHitPointMethod = MonsterStorageGrpc.getGetMaxHitPointMethod) == null) {
|
||||
MonsterStorageGrpc.getGetMaxHitPointMethod = getGetMaxHitPointMethod =
|
||||
io.grpc.MethodDescriptor.<MyGame.Example.Monster, MyGame.Example.Stat>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
|
||||
.setFullMethodName(generateFullMethodName(
|
||||
"MyGame.Example.MonsterStorage", "GetMaxHitPoint"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(FlatbuffersUtils.marshaller(
|
||||
MyGame.Example.Monster.class, getExtractorOfMonster()))
|
||||
.setResponseMarshaller(FlatbuffersUtils.marshaller(
|
||||
MyGame.Example.Stat.class, getExtractorOfStat()))
|
||||
.setSchemaDescriptor(null)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getGetMaxHitPointMethod;
|
||||
}
|
||||
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||
@java.lang.Deprecated // Use {@link #getGetMinMaxHitPointsMethod()} instead.
|
||||
public static final io.grpc.MethodDescriptor<MyGame.Example.Monster,
|
||||
MyGame.Example.Stat> METHOD_GET_MIN_MAX_HIT_POINTS = getGetMinMaxHitPointsMethod();
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<MyGame.Example.Monster,
|
||||
MyGame.Example.Stat> getGetMinMaxHitPointsMethod;
|
||||
|
||||
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||
public static io.grpc.MethodDescriptor<MyGame.Example.Monster,
|
||||
MyGame.Example.Stat> getGetMinMaxHitPointsMethod() {
|
||||
io.grpc.MethodDescriptor<MyGame.Example.Monster, MyGame.Example.Stat> getGetMinMaxHitPointsMethod;
|
||||
if ((getGetMinMaxHitPointsMethod = MonsterStorageGrpc.getGetMinMaxHitPointsMethod) == null) {
|
||||
synchronized (MonsterStorageGrpc.class) {
|
||||
if ((getGetMinMaxHitPointsMethod = MonsterStorageGrpc.getGetMinMaxHitPointsMethod) == null) {
|
||||
MonsterStorageGrpc.getGetMinMaxHitPointsMethod = getGetMinMaxHitPointsMethod =
|
||||
io.grpc.MethodDescriptor.<MyGame.Example.Monster, MyGame.Example.Stat>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
||||
.setFullMethodName(generateFullMethodName(
|
||||
"MyGame.Example.MonsterStorage", "GetMinMaxHitPoints"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(FlatbuffersUtils.marshaller(
|
||||
MyGame.Example.Monster.class, getExtractorOfMonster()))
|
||||
.setResponseMarshaller(FlatbuffersUtils.marshaller(
|
||||
MyGame.Example.Stat.class, getExtractorOfStat()))
|
||||
.setSchemaDescriptor(null)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getGetMinMaxHitPointsMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new async stub that supports all call types for the service
|
||||
*/
|
||||
public static MonsterStorageStub newStub(io.grpc.Channel channel) {
|
||||
return new MonsterStorageStub(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
public static MonsterStorageBlockingStub newBlockingStub(
|
||||
io.grpc.Channel channel) {
|
||||
return new MonsterStorageBlockingStub(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ListenableFuture-style stub that supports unary calls on the service
|
||||
*/
|
||||
public static MonsterStorageFutureStub newFutureStub(
|
||||
io.grpc.Channel channel) {
|
||||
return new MonsterStorageFutureStub(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static abstract class MonsterStorageImplBase implements io.grpc.BindableService {
|
||||
|
||||
/**
|
||||
*/
|
||||
public void store(MyGame.Example.Monster request,
|
||||
io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver) {
|
||||
asyncUnimplementedUnaryCall(getStoreMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void retrieve(MyGame.Example.Stat request,
|
||||
io.grpc.stub.StreamObserver<MyGame.Example.Monster> responseObserver) {
|
||||
asyncUnimplementedUnaryCall(getRetrieveMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<MyGame.Example.Monster> getMaxHitPoint(
|
||||
io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver) {
|
||||
return asyncUnimplementedStreamingCall(getGetMaxHitPointMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<MyGame.Example.Monster> getMinMaxHitPoints(
|
||||
io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver) {
|
||||
return asyncUnimplementedStreamingCall(getGetMinMaxHitPointsMethod(), responseObserver);
|
||||
}
|
||||
|
||||
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
||||
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
||||
.addMethod(
|
||||
getStoreMethod(),
|
||||
asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
MyGame.Example.Monster,
|
||||
MyGame.Example.Stat>(
|
||||
this, METHODID_STORE)))
|
||||
.addMethod(
|
||||
getRetrieveMethod(),
|
||||
asyncServerStreamingCall(
|
||||
new MethodHandlers<
|
||||
MyGame.Example.Stat,
|
||||
MyGame.Example.Monster>(
|
||||
this, METHODID_RETRIEVE)))
|
||||
.addMethod(
|
||||
getGetMaxHitPointMethod(),
|
||||
asyncClientStreamingCall(
|
||||
new MethodHandlers<
|
||||
MyGame.Example.Monster,
|
||||
MyGame.Example.Stat>(
|
||||
this, METHODID_GET_MAX_HIT_POINT)))
|
||||
.addMethod(
|
||||
getGetMinMaxHitPointsMethod(),
|
||||
asyncBidiStreamingCall(
|
||||
new MethodHandlers<
|
||||
MyGame.Example.Monster,
|
||||
MyGame.Example.Stat>(
|
||||
this, METHODID_GET_MIN_MAX_HIT_POINTS)))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static final class MonsterStorageStub extends io.grpc.stub.AbstractStub<MonsterStorageStub> {
|
||||
private MonsterStorageStub(io.grpc.Channel channel) {
|
||||
super(channel);
|
||||
}
|
||||
|
||||
private MonsterStorageStub(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected MonsterStorageStub build(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
return new MonsterStorageStub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void store(MyGame.Example.Monster request,
|
||||
io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver) {
|
||||
asyncUnaryCall(
|
||||
getChannel().newCall(getStoreMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void retrieve(MyGame.Example.Stat request,
|
||||
io.grpc.stub.StreamObserver<MyGame.Example.Monster> responseObserver) {
|
||||
asyncServerStreamingCall(
|
||||
getChannel().newCall(getRetrieveMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<MyGame.Example.Monster> getMaxHitPoint(
|
||||
io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver) {
|
||||
return asyncClientStreamingCall(
|
||||
getChannel().newCall(getGetMaxHitPointMethod(), getCallOptions()), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<MyGame.Example.Monster> getMinMaxHitPoints(
|
||||
io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver) {
|
||||
return asyncBidiStreamingCall(
|
||||
getChannel().newCall(getGetMinMaxHitPointsMethod(), getCallOptions()), responseObserver);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static final class MonsterStorageBlockingStub extends io.grpc.stub.AbstractStub<MonsterStorageBlockingStub> {
|
||||
private MonsterStorageBlockingStub(io.grpc.Channel channel) {
|
||||
super(channel);
|
||||
}
|
||||
|
||||
private MonsterStorageBlockingStub(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected MonsterStorageBlockingStub build(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
return new MonsterStorageBlockingStub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public MyGame.Example.Stat store(MyGame.Example.Monster request) {
|
||||
return blockingUnaryCall(
|
||||
getChannel(), getStoreMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public java.util.Iterator<MyGame.Example.Monster> retrieve(
|
||||
MyGame.Example.Stat request) {
|
||||
return blockingServerStreamingCall(
|
||||
getChannel(), getRetrieveMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static final class MonsterStorageFutureStub extends io.grpc.stub.AbstractStub<MonsterStorageFutureStub> {
|
||||
private MonsterStorageFutureStub(io.grpc.Channel channel) {
|
||||
super(channel);
|
||||
}
|
||||
|
||||
private MonsterStorageFutureStub(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected MonsterStorageFutureStub build(io.grpc.Channel channel,
|
||||
io.grpc.CallOptions callOptions) {
|
||||
return new MonsterStorageFutureStub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<MyGame.Example.Stat> store(
|
||||
MyGame.Example.Monster request) {
|
||||
return futureUnaryCall(
|
||||
getChannel().newCall(getStoreMethod(), getCallOptions()), request);
|
||||
}
|
||||
}
|
||||
|
||||
private static final int METHODID_STORE = 0;
|
||||
private static final int METHODID_RETRIEVE = 1;
|
||||
private static final int METHODID_GET_MIN_MAX_HIT_POINTS = 2;
|
||||
private static final int METHODID_GET_MAX_HIT_POINT = 3;
|
||||
|
||||
private static final class MethodHandlers<Req, Resp> implements
|
||||
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
||||
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
|
||||
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
|
||||
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
|
||||
private final MonsterStorageImplBase serviceImpl;
|
||||
private final int methodId;
|
||||
|
||||
MethodHandlers(MonsterStorageImplBase serviceImpl, int methodId) {
|
||||
this.serviceImpl = serviceImpl;
|
||||
this.methodId = methodId;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("unchecked")
|
||||
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
|
||||
switch (methodId) {
|
||||
case METHODID_STORE:
|
||||
serviceImpl.store((MyGame.Example.Monster) request,
|
||||
(io.grpc.stub.StreamObserver<MyGame.Example.Stat>) responseObserver);
|
||||
break;
|
||||
case METHODID_RETRIEVE:
|
||||
serviceImpl.retrieve((MyGame.Example.Stat) request,
|
||||
(io.grpc.stub.StreamObserver<MyGame.Example.Monster>) responseObserver);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("unchecked")
|
||||
public io.grpc.stub.StreamObserver<Req> invoke(
|
||||
io.grpc.stub.StreamObserver<Resp> responseObserver) {
|
||||
switch (methodId) {
|
||||
case METHODID_GET_MAX_HIT_POINT:
|
||||
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.getMaxHitPoint(
|
||||
(io.grpc.stub.StreamObserver<MyGame.Example.Stat>) responseObserver);
|
||||
case METHODID_GET_MIN_MAX_HIT_POINTS:
|
||||
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.getMinMaxHitPoints(
|
||||
(io.grpc.stub.StreamObserver<MyGame.Example.Stat>) responseObserver);
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
|
||||
|
||||
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
|
||||
io.grpc.ServiceDescriptor result = serviceDescriptor;
|
||||
if (result == null) {
|
||||
synchronized (MonsterStorageGrpc.class) {
|
||||
result = serviceDescriptor;
|
||||
if (result == null) {
|
||||
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
|
||||
.setSchemaDescriptor(null)
|
||||
.addMethod(getStoreMethod())
|
||||
.addMethod(getRetrieveMethod())
|
||||
.addMethod(getGetMaxHitPointMethod())
|
||||
.addMethod(getGetMinMaxHitPointsMethod())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
//Generated by gRPC Go plugin
|
||||
//If you make any local changes, they will be lost
|
||||
//source: monster_test
|
||||
|
||||
package Example
|
||||
|
||||
import (
|
||||
context "context"
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
grpc "google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// Client API for MonsterStorage service
|
||||
type MonsterStorageClient interface {
|
||||
Store(ctx context.Context, in *flatbuffers.Builder,
|
||||
opts ...grpc.CallOption) (*Stat, error)
|
||||
Retrieve(ctx context.Context, in *flatbuffers.Builder,
|
||||
opts ...grpc.CallOption) (MonsterStorage_RetrieveClient, error)
|
||||
GetMaxHitPoint(ctx context.Context,
|
||||
opts ...grpc.CallOption) (MonsterStorage_GetMaxHitPointClient, error)
|
||||
GetMinMaxHitPoints(ctx context.Context,
|
||||
opts ...grpc.CallOption) (MonsterStorage_GetMinMaxHitPointsClient, error)
|
||||
}
|
||||
|
||||
type monsterStorageClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewMonsterStorageClient(cc grpc.ClientConnInterface) MonsterStorageClient {
|
||||
return &monsterStorageClient{cc}
|
||||
}
|
||||
|
||||
func (c *monsterStorageClient) Store(ctx context.Context, in *flatbuffers.Builder,
|
||||
opts ...grpc.CallOption) (*Stat, error) {
|
||||
out := new(Stat)
|
||||
err := c.cc.Invoke(ctx, "/MyGame.Example.MonsterStorage/Store", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *monsterStorageClient) Retrieve(ctx context.Context, in *flatbuffers.Builder,
|
||||
opts ...grpc.CallOption) (MonsterStorage_RetrieveClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &_MonsterStorage_serviceDesc.Streams[0], "/MyGame.Example.MonsterStorage/Retrieve", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &monsterStorageRetrieveClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type MonsterStorage_RetrieveClient interface {
|
||||
Recv() (*Monster, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type monsterStorageRetrieveClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *monsterStorageRetrieveClient) Recv() (*Monster, error) {
|
||||
m := new(Monster)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *monsterStorageClient) GetMaxHitPoint(ctx context.Context,
|
||||
opts ...grpc.CallOption) (MonsterStorage_GetMaxHitPointClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &_MonsterStorage_serviceDesc.Streams[1], "/MyGame.Example.MonsterStorage/GetMaxHitPoint", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &monsterStorageGetMaxHitPointClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type MonsterStorage_GetMaxHitPointClient interface {
|
||||
Send(*flatbuffers.Builder) error
|
||||
CloseAndRecv() (*Stat, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type monsterStorageGetMaxHitPointClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *monsterStorageGetMaxHitPointClient) Send(m *flatbuffers.Builder) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *monsterStorageGetMaxHitPointClient) CloseAndRecv() (*Stat, error) {
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m := new(Stat)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *monsterStorageClient) GetMinMaxHitPoints(ctx context.Context,
|
||||
opts ...grpc.CallOption) (MonsterStorage_GetMinMaxHitPointsClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &_MonsterStorage_serviceDesc.Streams[2], "/MyGame.Example.MonsterStorage/GetMinMaxHitPoints", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &monsterStorageGetMinMaxHitPointsClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type MonsterStorage_GetMinMaxHitPointsClient interface {
|
||||
Send(*flatbuffers.Builder) error
|
||||
Recv() (*Stat, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type monsterStorageGetMinMaxHitPointsClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *monsterStorageGetMinMaxHitPointsClient) Send(m *flatbuffers.Builder) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *monsterStorageGetMinMaxHitPointsClient) Recv() (*Stat, error) {
|
||||
m := new(Stat)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for MonsterStorage service
|
||||
type MonsterStorageServer interface {
|
||||
Store(context.Context, *Monster) (*flatbuffers.Builder, error)
|
||||
Retrieve(*Stat, MonsterStorage_RetrieveServer) error
|
||||
GetMaxHitPoint(MonsterStorage_GetMaxHitPointServer) error
|
||||
GetMinMaxHitPoints(MonsterStorage_GetMinMaxHitPointsServer) error
|
||||
mustEmbedUnimplementedMonsterStorageServer()
|
||||
}
|
||||
|
||||
type UnimplementedMonsterStorageServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedMonsterStorageServer) Store(context.Context, *Monster) (*flatbuffers.Builder, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Store not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedMonsterStorageServer) Retrieve(*Stat, MonsterStorage_RetrieveServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method Retrieve not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedMonsterStorageServer) GetMaxHitPoint(MonsterStorage_GetMaxHitPointServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method GetMaxHitPoint not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedMonsterStorageServer) GetMinMaxHitPoints(MonsterStorage_GetMinMaxHitPointsServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method GetMinMaxHitPoints not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedMonsterStorageServer) mustEmbedUnimplementedMonsterStorageServer() {}
|
||||
|
||||
type UnsafeMonsterStorageServer interface {
|
||||
mustEmbedUnimplementedMonsterStorageServer()
|
||||
}
|
||||
|
||||
func RegisterMonsterStorageServer(s grpc.ServiceRegistrar, srv MonsterStorageServer) {
|
||||
s.RegisterService(&_MonsterStorage_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _MonsterStorage_Store_Handler(srv interface{}, ctx context.Context,
|
||||
dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Monster)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MonsterStorageServer).Store(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/MyGame.Example.MonsterStorage/Store",
|
||||
}
|
||||
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MonsterStorageServer).Store(ctx, req.(*Monster))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
func _MonsterStorage_Retrieve_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(Stat)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(MonsterStorageServer).Retrieve(m, &monsterStorageRetrieveServer{stream})
|
||||
}
|
||||
|
||||
type MonsterStorage_RetrieveServer interface {
|
||||
Send(*flatbuffers.Builder) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type monsterStorageRetrieveServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *monsterStorageRetrieveServer) Send(m *flatbuffers.Builder) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _MonsterStorage_GetMaxHitPoint_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(MonsterStorageServer).GetMaxHitPoint(&monsterStorageGetMaxHitPointServer{stream})
|
||||
}
|
||||
|
||||
type MonsterStorage_GetMaxHitPointServer interface {
|
||||
Recv() (*Monster, error)
|
||||
SendAndClose(*flatbuffers.Builder) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type monsterStorageGetMaxHitPointServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *monsterStorageGetMaxHitPointServer) Recv() (*Monster, error) {
|
||||
m := new(Monster)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (x *monsterStorageGetMaxHitPointServer) SendAndClose(m *flatbuffers.Builder) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _MonsterStorage_GetMinMaxHitPoints_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(MonsterStorageServer).GetMinMaxHitPoints(&monsterStorageGetMinMaxHitPointsServer{stream})
|
||||
}
|
||||
|
||||
type MonsterStorage_GetMinMaxHitPointsServer interface {
|
||||
Send(*flatbuffers.Builder) error
|
||||
Recv() (*Monster, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type monsterStorageGetMinMaxHitPointsServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *monsterStorageGetMinMaxHitPointsServer) Send(m *flatbuffers.Builder) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *monsterStorageGetMinMaxHitPointsServer) Recv() (*Monster, error) {
|
||||
m := new(Monster)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
var _MonsterStorage_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "MyGame.Example.MonsterStorage",
|
||||
HandlerType: (*MonsterStorageServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Store",
|
||||
Handler: _MonsterStorage_Store_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "Retrieve",
|
||||
Handler: _MonsterStorage_Retrieve_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "GetMaxHitPoint",
|
||||
Handler: _MonsterStorage_GetMaxHitPoint_Handler,
|
||||
ClientStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "GetMinMaxHitPoints",
|
||||
Handler: _MonsterStorage_GetMinMaxHitPoints_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,384 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
public class MonsterT {
|
||||
private MyGame.Example.Vec3T pos;
|
||||
private short mana;
|
||||
private short hp;
|
||||
private String name;
|
||||
private int[] inventory;
|
||||
private int color;
|
||||
private MyGame.Example.AnyUnion test;
|
||||
private MyGame.Example.TestT[] test4;
|
||||
private String[] testarrayofstring;
|
||||
private MyGame.Example.MonsterT[] testarrayoftables;
|
||||
private MyGame.Example.MonsterT enemy;
|
||||
private int[] testnestedflatbuffer;
|
||||
private MyGame.Example.StatT testempty;
|
||||
private boolean testbool;
|
||||
private int testhashs32Fnv1;
|
||||
private long testhashu32Fnv1;
|
||||
private long testhashs64Fnv1;
|
||||
private long testhashu64Fnv1;
|
||||
private int testhashs32Fnv1a;
|
||||
private long testhashu32Fnv1a;
|
||||
private long testhashs64Fnv1a;
|
||||
private long testhashu64Fnv1a;
|
||||
private boolean[] testarrayofbools;
|
||||
private float testf;
|
||||
private float testf2;
|
||||
private float testf3;
|
||||
private String[] testarrayofstring2;
|
||||
private MyGame.Example.AbilityT[] testarrayofsortedstruct;
|
||||
private int[] flex;
|
||||
private MyGame.Example.TestT[] test5;
|
||||
private long[] vectorOfLongs;
|
||||
private double[] vectorOfDoubles;
|
||||
private MyGame.InParentNamespaceT parentNamespaceTest;
|
||||
private MyGame.Example.ReferrableT[] vectorOfReferrables;
|
||||
private long singleWeakReference;
|
||||
private long[] vectorOfWeakReferences;
|
||||
private MyGame.Example.ReferrableT[] vectorOfStrongReferrables;
|
||||
private long coOwningReference;
|
||||
private long[] vectorOfCoOwningReferences;
|
||||
private long nonOwningReference;
|
||||
private long[] vectorOfNonOwningReferences;
|
||||
private MyGame.Example.AnyUniqueAliasesUnion anyUnique;
|
||||
private MyGame.Example.AnyAmbiguousAliasesUnion anyAmbiguous;
|
||||
private int[] vectorOfEnums;
|
||||
private byte signedEnum;
|
||||
private int[] testrequirednestedflatbuffer;
|
||||
private MyGame.Example.StatT[] scalarKeySortedTables;
|
||||
private MyGame.Example.TestT nativeInline;
|
||||
private long longEnumNonEnumDefault;
|
||||
private long longEnumNormalDefault;
|
||||
private float nanDefault;
|
||||
private float infDefault;
|
||||
private float positiveInfDefault;
|
||||
private float infinityDefault;
|
||||
private float positiveInfinityDefault;
|
||||
private float negativeInfDefault;
|
||||
private float negativeInfinityDefault;
|
||||
private double doubleInfDefault;
|
||||
|
||||
public MyGame.Example.Vec3T getPos() { return pos; }
|
||||
|
||||
public void setPos(MyGame.Example.Vec3T pos) { this.pos = pos; }
|
||||
|
||||
public short getMana() { return mana; }
|
||||
|
||||
public void setMana(short mana) { this.mana = mana; }
|
||||
|
||||
public short getHp() { return hp; }
|
||||
|
||||
public void setHp(short hp) { this.hp = hp; }
|
||||
|
||||
public String getName() { return name; }
|
||||
|
||||
public void setName(String name) { this.name = name; }
|
||||
|
||||
public int[] getInventory() { return inventory; }
|
||||
|
||||
public void setInventory(int[] inventory) { this.inventory = inventory; }
|
||||
|
||||
public int getColor() { return color; }
|
||||
|
||||
public void setColor(int color) { this.color = color; }
|
||||
|
||||
public MyGame.Example.AnyUnion getTest() { return test; }
|
||||
|
||||
public void setTest(MyGame.Example.AnyUnion test) { this.test = test; }
|
||||
|
||||
public MyGame.Example.TestT[] getTest4() { return test4; }
|
||||
|
||||
public void setTest4(MyGame.Example.TestT[] test4) { this.test4 = test4; }
|
||||
|
||||
public String[] getTestarrayofstring() { return testarrayofstring; }
|
||||
|
||||
public void setTestarrayofstring(String[] testarrayofstring) { this.testarrayofstring = testarrayofstring; }
|
||||
|
||||
public MyGame.Example.MonsterT[] getTestarrayoftables() { return testarrayoftables; }
|
||||
|
||||
public void setTestarrayoftables(MyGame.Example.MonsterT[] testarrayoftables) { this.testarrayoftables = testarrayoftables; }
|
||||
|
||||
public MyGame.Example.MonsterT getEnemy() { return enemy; }
|
||||
|
||||
public void setEnemy(MyGame.Example.MonsterT enemy) { this.enemy = enemy; }
|
||||
|
||||
public int[] getTestnestedflatbuffer() { return testnestedflatbuffer; }
|
||||
|
||||
public void setTestnestedflatbuffer(int[] testnestedflatbuffer) { this.testnestedflatbuffer = testnestedflatbuffer; }
|
||||
|
||||
public MyGame.Example.StatT getTestempty() { return testempty; }
|
||||
|
||||
public void setTestempty(MyGame.Example.StatT testempty) { this.testempty = testempty; }
|
||||
|
||||
public boolean getTestbool() { return testbool; }
|
||||
|
||||
public void setTestbool(boolean testbool) { this.testbool = testbool; }
|
||||
|
||||
public int getTesthashs32Fnv1() { return testhashs32Fnv1; }
|
||||
|
||||
public void setTesthashs32Fnv1(int testhashs32Fnv1) { this.testhashs32Fnv1 = testhashs32Fnv1; }
|
||||
|
||||
public long getTesthashu32Fnv1() { return testhashu32Fnv1; }
|
||||
|
||||
public void setTesthashu32Fnv1(long testhashu32Fnv1) { this.testhashu32Fnv1 = testhashu32Fnv1; }
|
||||
|
||||
public long getTesthashs64Fnv1() { return testhashs64Fnv1; }
|
||||
|
||||
public void setTesthashs64Fnv1(long testhashs64Fnv1) { this.testhashs64Fnv1 = testhashs64Fnv1; }
|
||||
|
||||
public long getTesthashu64Fnv1() { return testhashu64Fnv1; }
|
||||
|
||||
public void setTesthashu64Fnv1(long testhashu64Fnv1) { this.testhashu64Fnv1 = testhashu64Fnv1; }
|
||||
|
||||
public int getTesthashs32Fnv1a() { return testhashs32Fnv1a; }
|
||||
|
||||
public void setTesthashs32Fnv1a(int testhashs32Fnv1a) { this.testhashs32Fnv1a = testhashs32Fnv1a; }
|
||||
|
||||
public long getTesthashu32Fnv1a() { return testhashu32Fnv1a; }
|
||||
|
||||
public void setTesthashu32Fnv1a(long testhashu32Fnv1a) { this.testhashu32Fnv1a = testhashu32Fnv1a; }
|
||||
|
||||
public long getTesthashs64Fnv1a() { return testhashs64Fnv1a; }
|
||||
|
||||
public void setTesthashs64Fnv1a(long testhashs64Fnv1a) { this.testhashs64Fnv1a = testhashs64Fnv1a; }
|
||||
|
||||
public long getTesthashu64Fnv1a() { return testhashu64Fnv1a; }
|
||||
|
||||
public void setTesthashu64Fnv1a(long testhashu64Fnv1a) { this.testhashu64Fnv1a = testhashu64Fnv1a; }
|
||||
|
||||
public boolean[] getTestarrayofbools() { return testarrayofbools; }
|
||||
|
||||
public void setTestarrayofbools(boolean[] testarrayofbools) { this.testarrayofbools = testarrayofbools; }
|
||||
|
||||
public float getTestf() { return testf; }
|
||||
|
||||
public void setTestf(float testf) { this.testf = testf; }
|
||||
|
||||
public float getTestf2() { return testf2; }
|
||||
|
||||
public void setTestf2(float testf2) { this.testf2 = testf2; }
|
||||
|
||||
public float getTestf3() { return testf3; }
|
||||
|
||||
public void setTestf3(float testf3) { this.testf3 = testf3; }
|
||||
|
||||
public String[] getTestarrayofstring2() { return testarrayofstring2; }
|
||||
|
||||
public void setTestarrayofstring2(String[] testarrayofstring2) { this.testarrayofstring2 = testarrayofstring2; }
|
||||
|
||||
public MyGame.Example.AbilityT[] getTestarrayofsortedstruct() { return testarrayofsortedstruct; }
|
||||
|
||||
public void setTestarrayofsortedstruct(MyGame.Example.AbilityT[] testarrayofsortedstruct) { this.testarrayofsortedstruct = testarrayofsortedstruct; }
|
||||
|
||||
public int[] getFlex() { return flex; }
|
||||
|
||||
public void setFlex(int[] flex) { this.flex = flex; }
|
||||
|
||||
public MyGame.Example.TestT[] getTest5() { return test5; }
|
||||
|
||||
public void setTest5(MyGame.Example.TestT[] test5) { this.test5 = test5; }
|
||||
|
||||
public long[] getVectorOfLongs() { return vectorOfLongs; }
|
||||
|
||||
public void setVectorOfLongs(long[] vectorOfLongs) { this.vectorOfLongs = vectorOfLongs; }
|
||||
|
||||
public double[] getVectorOfDoubles() { return vectorOfDoubles; }
|
||||
|
||||
public void setVectorOfDoubles(double[] vectorOfDoubles) { this.vectorOfDoubles = vectorOfDoubles; }
|
||||
|
||||
public MyGame.InParentNamespaceT getParentNamespaceTest() { return parentNamespaceTest; }
|
||||
|
||||
public void setParentNamespaceTest(MyGame.InParentNamespaceT parentNamespaceTest) { this.parentNamespaceTest = parentNamespaceTest; }
|
||||
|
||||
public MyGame.Example.ReferrableT[] getVectorOfReferrables() { return vectorOfReferrables; }
|
||||
|
||||
public void setVectorOfReferrables(MyGame.Example.ReferrableT[] vectorOfReferrables) { this.vectorOfReferrables = vectorOfReferrables; }
|
||||
|
||||
public long getSingleWeakReference() { return singleWeakReference; }
|
||||
|
||||
public void setSingleWeakReference(long singleWeakReference) { this.singleWeakReference = singleWeakReference; }
|
||||
|
||||
public long[] getVectorOfWeakReferences() { return vectorOfWeakReferences; }
|
||||
|
||||
public void setVectorOfWeakReferences(long[] vectorOfWeakReferences) { this.vectorOfWeakReferences = vectorOfWeakReferences; }
|
||||
|
||||
public MyGame.Example.ReferrableT[] getVectorOfStrongReferrables() { return vectorOfStrongReferrables; }
|
||||
|
||||
public void setVectorOfStrongReferrables(MyGame.Example.ReferrableT[] vectorOfStrongReferrables) { this.vectorOfStrongReferrables = vectorOfStrongReferrables; }
|
||||
|
||||
public long getCoOwningReference() { return coOwningReference; }
|
||||
|
||||
public void setCoOwningReference(long coOwningReference) { this.coOwningReference = coOwningReference; }
|
||||
|
||||
public long[] getVectorOfCoOwningReferences() { return vectorOfCoOwningReferences; }
|
||||
|
||||
public void setVectorOfCoOwningReferences(long[] vectorOfCoOwningReferences) { this.vectorOfCoOwningReferences = vectorOfCoOwningReferences; }
|
||||
|
||||
public long getNonOwningReference() { return nonOwningReference; }
|
||||
|
||||
public void setNonOwningReference(long nonOwningReference) { this.nonOwningReference = nonOwningReference; }
|
||||
|
||||
public long[] getVectorOfNonOwningReferences() { return vectorOfNonOwningReferences; }
|
||||
|
||||
public void setVectorOfNonOwningReferences(long[] vectorOfNonOwningReferences) { this.vectorOfNonOwningReferences = vectorOfNonOwningReferences; }
|
||||
|
||||
public MyGame.Example.AnyUniqueAliasesUnion getAnyUnique() { return anyUnique; }
|
||||
|
||||
public void setAnyUnique(MyGame.Example.AnyUniqueAliasesUnion anyUnique) { this.anyUnique = anyUnique; }
|
||||
|
||||
public MyGame.Example.AnyAmbiguousAliasesUnion getAnyAmbiguous() { return anyAmbiguous; }
|
||||
|
||||
public void setAnyAmbiguous(MyGame.Example.AnyAmbiguousAliasesUnion anyAmbiguous) { this.anyAmbiguous = anyAmbiguous; }
|
||||
|
||||
public int[] getVectorOfEnums() { return vectorOfEnums; }
|
||||
|
||||
public void setVectorOfEnums(int[] vectorOfEnums) { this.vectorOfEnums = vectorOfEnums; }
|
||||
|
||||
public byte getSignedEnum() { return signedEnum; }
|
||||
|
||||
public void setSignedEnum(byte signedEnum) { this.signedEnum = signedEnum; }
|
||||
|
||||
public int[] getTestrequirednestedflatbuffer() { return testrequirednestedflatbuffer; }
|
||||
|
||||
public void setTestrequirednestedflatbuffer(int[] testrequirednestedflatbuffer) { this.testrequirednestedflatbuffer = testrequirednestedflatbuffer; }
|
||||
|
||||
public MyGame.Example.StatT[] getScalarKeySortedTables() { return scalarKeySortedTables; }
|
||||
|
||||
public void setScalarKeySortedTables(MyGame.Example.StatT[] scalarKeySortedTables) { this.scalarKeySortedTables = scalarKeySortedTables; }
|
||||
|
||||
public MyGame.Example.TestT getNativeInline() { return nativeInline; }
|
||||
|
||||
public void setNativeInline(MyGame.Example.TestT nativeInline) { this.nativeInline = nativeInline; }
|
||||
|
||||
public long getLongEnumNonEnumDefault() { return longEnumNonEnumDefault; }
|
||||
|
||||
public void setLongEnumNonEnumDefault(long longEnumNonEnumDefault) { this.longEnumNonEnumDefault = longEnumNonEnumDefault; }
|
||||
|
||||
public long getLongEnumNormalDefault() { return longEnumNormalDefault; }
|
||||
|
||||
public void setLongEnumNormalDefault(long longEnumNormalDefault) { this.longEnumNormalDefault = longEnumNormalDefault; }
|
||||
|
||||
public float getNanDefault() { return nanDefault; }
|
||||
|
||||
public void setNanDefault(float nanDefault) { this.nanDefault = nanDefault; }
|
||||
|
||||
public float getInfDefault() { return infDefault; }
|
||||
|
||||
public void setInfDefault(float infDefault) { this.infDefault = infDefault; }
|
||||
|
||||
public float getPositiveInfDefault() { return positiveInfDefault; }
|
||||
|
||||
public void setPositiveInfDefault(float positiveInfDefault) { this.positiveInfDefault = positiveInfDefault; }
|
||||
|
||||
public float getInfinityDefault() { return infinityDefault; }
|
||||
|
||||
public void setInfinityDefault(float infinityDefault) { this.infinityDefault = infinityDefault; }
|
||||
|
||||
public float getPositiveInfinityDefault() { return positiveInfinityDefault; }
|
||||
|
||||
public void setPositiveInfinityDefault(float positiveInfinityDefault) { this.positiveInfinityDefault = positiveInfinityDefault; }
|
||||
|
||||
public float getNegativeInfDefault() { return negativeInfDefault; }
|
||||
|
||||
public void setNegativeInfDefault(float negativeInfDefault) { this.negativeInfDefault = negativeInfDefault; }
|
||||
|
||||
public float getNegativeInfinityDefault() { return negativeInfinityDefault; }
|
||||
|
||||
public void setNegativeInfinityDefault(float negativeInfinityDefault) { this.negativeInfinityDefault = negativeInfinityDefault; }
|
||||
|
||||
public double getDoubleInfDefault() { return doubleInfDefault; }
|
||||
|
||||
public void setDoubleInfDefault(double doubleInfDefault) { this.doubleInfDefault = doubleInfDefault; }
|
||||
|
||||
|
||||
public MonsterT() {
|
||||
this.pos = new MyGame.Example.Vec3T();
|
||||
this.mana = 150;
|
||||
this.hp = 100;
|
||||
this.name = null;
|
||||
this.inventory = null;
|
||||
this.color = 8;
|
||||
this.test = null;
|
||||
this.test4 = null;
|
||||
this.testarrayofstring = null;
|
||||
this.testarrayoftables = null;
|
||||
this.enemy = null;
|
||||
this.testnestedflatbuffer = null;
|
||||
this.testempty = null;
|
||||
this.testbool = false;
|
||||
this.testhashs32Fnv1 = 0;
|
||||
this.testhashu32Fnv1 = 0L;
|
||||
this.testhashs64Fnv1 = 0L;
|
||||
this.testhashu64Fnv1 = 0L;
|
||||
this.testhashs32Fnv1a = 0;
|
||||
this.testhashu32Fnv1a = 0L;
|
||||
this.testhashs64Fnv1a = 0L;
|
||||
this.testhashu64Fnv1a = 0L;
|
||||
this.testarrayofbools = null;
|
||||
this.testf = 3.14159f;
|
||||
this.testf2 = 3.0f;
|
||||
this.testf3 = 0.0f;
|
||||
this.testarrayofstring2 = null;
|
||||
this.testarrayofsortedstruct = null;
|
||||
this.flex = null;
|
||||
this.test5 = null;
|
||||
this.vectorOfLongs = null;
|
||||
this.vectorOfDoubles = null;
|
||||
this.parentNamespaceTest = null;
|
||||
this.vectorOfReferrables = null;
|
||||
this.singleWeakReference = 0L;
|
||||
this.vectorOfWeakReferences = null;
|
||||
this.vectorOfStrongReferrables = null;
|
||||
this.coOwningReference = 0L;
|
||||
this.vectorOfCoOwningReferences = null;
|
||||
this.nonOwningReference = 0L;
|
||||
this.vectorOfNonOwningReferences = null;
|
||||
this.anyUnique = null;
|
||||
this.anyAmbiguous = null;
|
||||
this.vectorOfEnums = null;
|
||||
this.signedEnum = -1;
|
||||
this.testrequirednestedflatbuffer = null;
|
||||
this.scalarKeySortedTables = null;
|
||||
this.nativeInline = new MyGame.Example.TestT();
|
||||
this.longEnumNonEnumDefault = 0L;
|
||||
this.longEnumNormalDefault = 2L;
|
||||
this.nanDefault = Float.NaN;
|
||||
this.infDefault = Float.POSITIVE_INFINITY;
|
||||
this.positiveInfDefault = Float.POSITIVE_INFINITY;
|
||||
this.infinityDefault = Float.POSITIVE_INFINITY;
|
||||
this.positiveInfinityDefault = Float.POSITIVE_INFINITY;
|
||||
this.negativeInfDefault = Float.NEGATIVE_INFINITY;
|
||||
this.negativeInfinityDefault = Float.NEGATIVE_INFINITY;
|
||||
this.doubleInfDefault = Double.POSITIVE_INFINITY;
|
||||
}
|
||||
public static MonsterT deserializeFromBinary(byte[] fbBuffer) {
|
||||
return Monster.getRootAsMonster(ByteBuffer.wrap(fbBuffer)).unpack();
|
||||
}
|
||||
public byte[] serializeToBinary() {
|
||||
FlatBufferBuilder fbb = new FlatBufferBuilder();
|
||||
Monster.finishMonsterBuffer(fbb, Monster.pack(fbb, this));
|
||||
return fbb.sizedByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct NestedStruct : IFlatbufferObject
|
||||
{
|
||||
private Struct __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Struct(_i, _bb); }
|
||||
public NestedStruct __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int A(int j) { return __p.bb.GetInt(__p.bb_pos + 0 + j * 4); }
|
||||
public void MutateA(int j, int a) { __p.bb.PutInt(__p.bb_pos + 0 + j * 4, a); }
|
||||
public MyGame.Example.TestEnum B { get { return (MyGame.Example.TestEnum)__p.bb.GetSbyte(__p.bb_pos + 8); } }
|
||||
public void MutateB(MyGame.Example.TestEnum b) { __p.bb.PutSbyte(__p.bb_pos + 8, (sbyte)b); }
|
||||
public MyGame.Example.TestEnum C(int j) { return (MyGame.Example.TestEnum)__p.bb.GetSbyte(__p.bb_pos + 9 + j * 1); }
|
||||
public void MutateC(int j, MyGame.Example.TestEnum c) { __p.bb.PutSbyte(__p.bb_pos + 9 + j * 1, (sbyte)c); }
|
||||
public long D(int j) { return __p.bb.GetLong(__p.bb_pos + 16 + j * 8); }
|
||||
public void MutateD(int j, long d) { __p.bb.PutLong(__p.bb_pos + 16 + j * 8, d); }
|
||||
|
||||
public static Offset<MyGame.Example.NestedStruct> CreateNestedStruct(FlatBufferBuilder builder, int[] A, MyGame.Example.TestEnum B, MyGame.Example.TestEnum[] C, long[] D) {
|
||||
builder.Prep(8, 32);
|
||||
for (int _idx0 = 2; _idx0 > 0; _idx0--) {
|
||||
builder.PutLong(D[_idx0-1]);
|
||||
}
|
||||
builder.Pad(5);
|
||||
for (int _idx0 = 2; _idx0 > 0; _idx0--) {
|
||||
builder.PutSbyte((sbyte)C[_idx0-1]);
|
||||
}
|
||||
builder.PutSbyte((sbyte)B);
|
||||
for (int _idx0 = 2; _idx0 > 0; _idx0--) {
|
||||
builder.PutInt(A[_idx0-1]);
|
||||
}
|
||||
return new Offset<MyGame.Example.NestedStruct>(builder.Offset);
|
||||
}
|
||||
public NestedStructT UnPack() {
|
||||
var _o = new NestedStructT();
|
||||
this.UnPackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void UnPackTo(NestedStructT _o) {
|
||||
_o.A = new int[2];
|
||||
for (var _j = 0; _j < 2; ++_j) { _o.A[_j] = this.A(_j); }
|
||||
_o.B = this.B;
|
||||
_o.C = new MyGame.Example.TestEnum[2];
|
||||
for (var _j = 0; _j < 2; ++_j) { _o.C[_j] = this.C(_j); }
|
||||
_o.D = new long[2];
|
||||
for (var _j = 0; _j < 2; ++_j) { _o.D[_j] = this.D(_j); }
|
||||
}
|
||||
public static Offset<MyGame.Example.NestedStruct> Pack(FlatBufferBuilder builder, NestedStructT _o) {
|
||||
if (_o == null) return default(Offset<MyGame.Example.NestedStruct>);
|
||||
var _a = _o.A;
|
||||
var _c = _o.C;
|
||||
var _d = _o.D;
|
||||
return CreateNestedStruct(
|
||||
builder,
|
||||
_a,
|
||||
_o.B,
|
||||
_c,
|
||||
_d);
|
||||
}
|
||||
}
|
||||
|
||||
public class NestedStructT
|
||||
{
|
||||
[Newtonsoft.Json.JsonProperty("a")]
|
||||
public int[] A { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("b")]
|
||||
public MyGame.Example.TestEnum B { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("c")]
|
||||
public MyGame.Example.TestEnum[] C { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("d")]
|
||||
public long[] D { get; set; }
|
||||
|
||||
public NestedStructT() {
|
||||
this.A = new int[2];
|
||||
this.B = MyGame.Example.TestEnum.A;
|
||||
this.C = new MyGame.Example.TestEnum[2];
|
||||
this.D = new long[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class NestedStruct extends Struct {
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public NestedStruct __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int a(int j) { return bb.getInt(bb_pos + 0 + j * 4); }
|
||||
public void mutateA(int j, int a) { bb.putInt(bb_pos + 0 + j * 4, a); }
|
||||
public byte b() { return bb.get(bb_pos + 8); }
|
||||
public void mutateB(byte b) { bb.put(bb_pos + 8, b); }
|
||||
public byte c(int j) { return bb.get(bb_pos + 9 + j * 1); }
|
||||
public void mutateC(int j, byte c) { bb.put(bb_pos + 9 + j * 1, c); }
|
||||
public long d(int j) { return bb.getLong(bb_pos + 16 + j * 8); }
|
||||
public void mutateD(int j, long d) { bb.putLong(bb_pos + 16 + j * 8, d); }
|
||||
|
||||
public static int createNestedStruct(FlatBufferBuilder builder, int[] a, byte b, byte[] c, long[] d) {
|
||||
builder.prep(8, 32);
|
||||
for (int _idx0 = 2; _idx0 > 0; _idx0--) {
|
||||
builder.putLong(d[_idx0-1]);
|
||||
}
|
||||
builder.pad(5);
|
||||
for (int _idx0 = 2; _idx0 > 0; _idx0--) {
|
||||
builder.putByte(c[_idx0-1]);
|
||||
}
|
||||
builder.putByte(b);
|
||||
for (int _idx0 = 2; _idx0 > 0; _idx0--) {
|
||||
builder.putInt(a[_idx0-1]);
|
||||
}
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public NestedStruct get(int j) { return get(new NestedStruct(), j); }
|
||||
public NestedStruct get(NestedStruct obj, int j) { return obj.__assign(__element(j), bb); }
|
||||
}
|
||||
public NestedStructT unpack() {
|
||||
NestedStructT _o = new NestedStructT();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(NestedStructT _o) {
|
||||
int[] _oA = _o.getA();
|
||||
for (int _j = 0; _j < 2; ++_j) { _oA[_j] = a(_j); }
|
||||
byte _oB = b();
|
||||
_o.setB(_oB);
|
||||
byte[] _oC = _o.getC();
|
||||
for (int _j = 0; _j < 2; ++_j) { _oC[_j] = c(_j); }
|
||||
long[] _oD = _o.getD();
|
||||
for (int _j = 0; _j < 2; ++_j) { _oD[_j] = d(_j); }
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, NestedStructT _o) {
|
||||
if (_o == null) return 0;
|
||||
int[] _a = _o.getA();
|
||||
byte[] _c = _o.getC();
|
||||
long[] _d = _o.getD();
|
||||
return createNestedStruct(
|
||||
builder,
|
||||
_a,
|
||||
_o.getB(),
|
||||
_c,
|
||||
_d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
from typing import Any
|
||||
np = import_numpy()
|
||||
|
||||
class NestedStruct(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def SizeOf(cls) -> int:
|
||||
return 32
|
||||
|
||||
# NestedStruct
|
||||
def Init(self, buf: bytes, pos: int):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# NestedStruct
|
||||
def A(self, j = None):
|
||||
if j is None:
|
||||
return [self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0 + i * 4)) for i in range(self.ALength())]
|
||||
elif j >= 0 and j < self.ALength():
|
||||
return self._tab.Get(flatbuffers.number_types.Int32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0 + j * 4))
|
||||
else:
|
||||
return None
|
||||
|
||||
# NestedStruct
|
||||
def AAsNumpy(self):
|
||||
return self._tab.GetArrayAsNumpy(flatbuffers.number_types.Int32Flags, self._tab.Pos + 0, self.ALength())
|
||||
|
||||
# NestedStruct
|
||||
def ALength(self) -> int:
|
||||
return 2
|
||||
|
||||
# NestedStruct
|
||||
def AIsNone(self) -> bool:
|
||||
return False
|
||||
|
||||
# NestedStruct
|
||||
def B(self): return self._tab.Get(flatbuffers.number_types.Int8Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(8))
|
||||
# NestedStruct
|
||||
def C(self, j = None):
|
||||
if j is None:
|
||||
return [self._tab.Get(flatbuffers.number_types.Int8Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(9 + i * 1)) for i in range(self.CLength())]
|
||||
elif j >= 0 and j < self.CLength():
|
||||
return self._tab.Get(flatbuffers.number_types.Int8Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(9 + j * 1))
|
||||
else:
|
||||
return None
|
||||
|
||||
# NestedStruct
|
||||
def CAsNumpy(self):
|
||||
return self._tab.GetArrayAsNumpy(flatbuffers.number_types.Int8Flags, self._tab.Pos + 9, self.CLength())
|
||||
|
||||
# NestedStruct
|
||||
def CLength(self) -> int:
|
||||
return 2
|
||||
|
||||
# NestedStruct
|
||||
def CIsNone(self) -> bool:
|
||||
return False
|
||||
|
||||
# NestedStruct
|
||||
def D(self, j = None):
|
||||
if j is None:
|
||||
return [self._tab.Get(flatbuffers.number_types.Int64Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(16 + i * 8)) for i in range(self.DLength())]
|
||||
elif j >= 0 and j < self.DLength():
|
||||
return self._tab.Get(flatbuffers.number_types.Int64Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(16 + j * 8))
|
||||
else:
|
||||
return None
|
||||
|
||||
# NestedStruct
|
||||
def DAsNumpy(self):
|
||||
return self._tab.GetArrayAsNumpy(flatbuffers.number_types.Int64Flags, self._tab.Pos + 16, self.DLength())
|
||||
|
||||
# NestedStruct
|
||||
def DLength(self) -> int:
|
||||
return 2
|
||||
|
||||
# NestedStruct
|
||||
def DIsNone(self) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def CreateNestedStruct(builder, a, b, c, d):
|
||||
builder.Prep(8, 32)
|
||||
for _idx0 in range(2 , 0, -1):
|
||||
builder.PrependInt64(d[_idx0-1])
|
||||
builder.Pad(5)
|
||||
for _idx0 in range(2 , 0, -1):
|
||||
builder.PrependInt8(c[_idx0-1])
|
||||
builder.PrependInt8(b)
|
||||
for _idx0 in range(2 , 0, -1):
|
||||
builder.PrependInt32(a[_idx0-1])
|
||||
return builder.Offset()
|
||||
|
||||
try:
|
||||
from typing import List
|
||||
except:
|
||||
pass
|
||||
|
||||
class NestedStructT(object):
|
||||
|
||||
# NestedStructT
|
||||
def __init__(self):
|
||||
self.a = None # type: List[int]
|
||||
self.b = 0 # type: int
|
||||
self.c = None # type: List[int]
|
||||
self.d = None # type: List[int]
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
nestedStruct = NestedStruct()
|
||||
nestedStruct.Init(buf, pos)
|
||||
return cls.InitFromObj(nestedStruct)
|
||||
|
||||
@classmethod
|
||||
def InitFromPackedBuf(cls, buf, pos=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
||||
return cls.InitFromBuf(buf, pos+n)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, nestedStruct):
|
||||
x = NestedStructT()
|
||||
x._UnPack(nestedStruct)
|
||||
return x
|
||||
|
||||
# NestedStructT
|
||||
def _UnPack(self, nestedStruct):
|
||||
if nestedStruct is None:
|
||||
return
|
||||
if not nestedStruct.AIsNone():
|
||||
if np is None:
|
||||
self.a = []
|
||||
for i in range(nestedStruct.ALength()):
|
||||
self.a.append(nestedStruct.A(i))
|
||||
else:
|
||||
self.a = nestedStruct.AAsNumpy()
|
||||
self.b = nestedStruct.B()
|
||||
if not nestedStruct.CIsNone():
|
||||
if np is None:
|
||||
self.c = []
|
||||
for i in range(nestedStruct.CLength()):
|
||||
self.c.append(nestedStruct.C(i))
|
||||
else:
|
||||
self.c = nestedStruct.CAsNumpy()
|
||||
if not nestedStruct.DIsNone():
|
||||
if np is None:
|
||||
self.d = []
|
||||
for i in range(nestedStruct.DLength()):
|
||||
self.d.append(nestedStruct.D(i))
|
||||
else:
|
||||
self.d = nestedStruct.DAsNumpy()
|
||||
|
||||
# NestedStructT
|
||||
def Pack(self, builder):
|
||||
return CreateNestedStruct(builder, self.a, self.b, self.c, self.d)
|
||||
@@ -0,0 +1,52 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
public class NestedStructT {
|
||||
private int[] a;
|
||||
private byte b;
|
||||
private byte[] c;
|
||||
private long[] d;
|
||||
|
||||
public int[] getA() { return a; }
|
||||
|
||||
public void setA(int[] a) { if (a != null && a.length == 2) this.a = a; }
|
||||
|
||||
public byte getB() { return b; }
|
||||
|
||||
public void setB(byte b) { this.b = b; }
|
||||
|
||||
public byte[] getC() { return c; }
|
||||
|
||||
public void setC(byte[] c) { if (c != null && c.length == 2) this.c = c; }
|
||||
|
||||
public long[] getD() { return d; }
|
||||
|
||||
public void setD(long[] d) { if (d != null && d.length == 2) this.d = d; }
|
||||
|
||||
|
||||
public NestedStructT() {
|
||||
this.a = new int[2];
|
||||
this.b = 0;
|
||||
this.c = new byte[2];
|
||||
this.d = new long[2];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NestedUnion
|
||||
|
||||
class Any(object):
|
||||
NONE = 0
|
||||
Vec3 = 1
|
||||
TestSimpleTableWithEnum = 2
|
||||
|
||||
def AnyCreator(unionType, table):
|
||||
from flatbuffers.table import Table
|
||||
if not isinstance(table, Table):
|
||||
return None
|
||||
if unionType == Any().Vec3:
|
||||
import MyGame.Example.NestedUnion.Vec3
|
||||
return MyGame.Example.NestedUnion.Vec3.Vec3T.InitFromBuf(table.Bytes, table.Pos)
|
||||
if unionType == Any().TestSimpleTableWithEnum:
|
||||
import MyGame.Example.NestedUnion.TestSimpleTableWithEnum
|
||||
return MyGame.Example.NestedUnion.TestSimpleTableWithEnum.TestSimpleTableWithEnumT.InitFromBuf(table.Bytes, table.Pos)
|
||||
return None
|
||||
@@ -0,0 +1,12 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NestedUnion
|
||||
|
||||
# Composite components of Monster color.
|
||||
class Color(object):
|
||||
Red = 1
|
||||
# \brief color Green
|
||||
# Green is bit_flag with value (1u << 1)
|
||||
Green = 2
|
||||
# \brief color Blue (1u << 3)
|
||||
Blue = 8
|
||||
@@ -0,0 +1,153 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NestedUnion
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
from typing import Any
|
||||
from flatbuffers.table import Table
|
||||
from typing import Optional
|
||||
np = import_numpy()
|
||||
|
||||
class NestedUnionTest(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset: int = 0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = NestedUnionTest()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def GetRootAsNestedUnionTest(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
# NestedUnionTest
|
||||
def Init(self, buf: bytes, pos: int):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# NestedUnionTest
|
||||
def Name(self) -> Optional[str]:
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
||||
if o != 0:
|
||||
return self._tab.String(o + self._tab.Pos)
|
||||
return None
|
||||
|
||||
# NestedUnionTest
|
||||
def DataType(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# NestedUnionTest
|
||||
def Data(self) -> Optional[flatbuffers.table.Table]:
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
||||
if o != 0:
|
||||
obj = Table(bytearray(), 0)
|
||||
self._tab.Union(obj, o)
|
||||
return obj
|
||||
return None
|
||||
|
||||
# NestedUnionTest
|
||||
def Id(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
def NestedUnionTestStart(builder: flatbuffers.Builder):
|
||||
builder.StartObject(4)
|
||||
|
||||
def Start(builder: flatbuffers.Builder):
|
||||
NestedUnionTestStart(builder)
|
||||
|
||||
def NestedUnionTestAddName(builder: flatbuffers.Builder, name: int):
|
||||
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
|
||||
|
||||
def AddName(builder: flatbuffers.Builder, name: int):
|
||||
NestedUnionTestAddName(builder, name)
|
||||
|
||||
def NestedUnionTestAddDataType(builder: flatbuffers.Builder, dataType: int):
|
||||
builder.PrependUint8Slot(1, dataType, 0)
|
||||
|
||||
def AddDataType(builder: flatbuffers.Builder, dataType: int):
|
||||
NestedUnionTestAddDataType(builder, dataType)
|
||||
|
||||
def NestedUnionTestAddData(builder: flatbuffers.Builder, data: int):
|
||||
builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0)
|
||||
|
||||
def AddData(builder: flatbuffers.Builder, data: int):
|
||||
NestedUnionTestAddData(builder, data)
|
||||
|
||||
def NestedUnionTestAddId(builder: flatbuffers.Builder, id: int):
|
||||
builder.PrependInt16Slot(3, id, 0)
|
||||
|
||||
def AddId(builder: flatbuffers.Builder, id: int):
|
||||
NestedUnionTestAddId(builder, id)
|
||||
|
||||
def NestedUnionTestEnd(builder: flatbuffers.Builder) -> int:
|
||||
return builder.EndObject()
|
||||
|
||||
def End(builder: flatbuffers.Builder) -> int:
|
||||
return NestedUnionTestEnd(builder)
|
||||
|
||||
import MyGame.Example.NestedUnion.Any
|
||||
import MyGame.Example.NestedUnion.TestSimpleTableWithEnum
|
||||
import MyGame.Example.NestedUnion.Vec3
|
||||
try:
|
||||
from typing import Union
|
||||
except:
|
||||
pass
|
||||
|
||||
class NestedUnionTestT(object):
|
||||
|
||||
# NestedUnionTestT
|
||||
def __init__(self):
|
||||
self.name = None # type: str
|
||||
self.dataType = 0 # type: int
|
||||
self.data = None # type: Union[None, MyGame.Example.NestedUnion.Vec3.Vec3T, MyGame.Example.NestedUnion.TestSimpleTableWithEnum.TestSimpleTableWithEnumT]
|
||||
self.id = 0 # type: int
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
nestedUnionTest = NestedUnionTest()
|
||||
nestedUnionTest.Init(buf, pos)
|
||||
return cls.InitFromObj(nestedUnionTest)
|
||||
|
||||
@classmethod
|
||||
def InitFromPackedBuf(cls, buf, pos=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
||||
return cls.InitFromBuf(buf, pos+n)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, nestedUnionTest):
|
||||
x = NestedUnionTestT()
|
||||
x._UnPack(nestedUnionTest)
|
||||
return x
|
||||
|
||||
# NestedUnionTestT
|
||||
def _UnPack(self, nestedUnionTest):
|
||||
if nestedUnionTest is None:
|
||||
return
|
||||
self.name = nestedUnionTest.Name()
|
||||
self.dataType = nestedUnionTest.DataType()
|
||||
self.data = MyGame.Example.NestedUnion.Any.AnyCreator(self.dataType, nestedUnionTest.Data())
|
||||
self.id = nestedUnionTest.Id()
|
||||
|
||||
# NestedUnionTestT
|
||||
def Pack(self, builder):
|
||||
if self.name is not None:
|
||||
name = builder.CreateString(self.name)
|
||||
if self.data is not None:
|
||||
data = self.data.Pack(builder)
|
||||
NestedUnionTestStart(builder)
|
||||
if self.name is not None:
|
||||
NestedUnionTestAddName(builder, name)
|
||||
NestedUnionTestAddDataType(builder, self.dataType)
|
||||
if self.data is not None:
|
||||
NestedUnionTestAddData(builder, data)
|
||||
NestedUnionTestAddId(builder, self.id)
|
||||
nestedUnionTest = NestedUnionTestEnd(builder)
|
||||
return nestedUnionTest
|
||||
@@ -0,0 +1,67 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NestedUnion
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
from typing import Any
|
||||
np = import_numpy()
|
||||
|
||||
class Test(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def SizeOf(cls) -> int:
|
||||
return 4
|
||||
|
||||
# Test
|
||||
def Init(self, buf: bytes, pos: int):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# Test
|
||||
def A(self): return self._tab.Get(flatbuffers.number_types.Int16Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0))
|
||||
# Test
|
||||
def B(self): return self._tab.Get(flatbuffers.number_types.Int8Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(2))
|
||||
|
||||
def CreateTest(builder, a, b):
|
||||
builder.Prep(2, 4)
|
||||
builder.Pad(1)
|
||||
builder.PrependInt8(b)
|
||||
builder.PrependInt16(a)
|
||||
return builder.Offset()
|
||||
|
||||
|
||||
class TestT(object):
|
||||
|
||||
# TestT
|
||||
def __init__(self):
|
||||
self.a = 0 # type: int
|
||||
self.b = 0 # type: int
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
test = Test()
|
||||
test.Init(buf, pos)
|
||||
return cls.InitFromObj(test)
|
||||
|
||||
@classmethod
|
||||
def InitFromPackedBuf(cls, buf, pos=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
||||
return cls.InitFromBuf(buf, pos+n)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, test):
|
||||
x = TestT()
|
||||
x._UnPack(test)
|
||||
return x
|
||||
|
||||
# TestT
|
||||
def _UnPack(self, test):
|
||||
if test is None:
|
||||
return
|
||||
self.a = test.A()
|
||||
self.b = test.B()
|
||||
|
||||
# TestT
|
||||
def Pack(self, builder):
|
||||
return CreateTest(builder, self.a, self.b)
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NestedUnion
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
from typing import Any
|
||||
np = import_numpy()
|
||||
|
||||
class TestSimpleTableWithEnum(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset: int = 0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = TestSimpleTableWithEnum()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def GetRootAsTestSimpleTableWithEnum(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
# TestSimpleTableWithEnum
|
||||
def Init(self, buf: bytes, pos: int):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# TestSimpleTableWithEnum
|
||||
def Color(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 2
|
||||
|
||||
def TestSimpleTableWithEnumStart(builder: flatbuffers.Builder):
|
||||
builder.StartObject(1)
|
||||
|
||||
def Start(builder: flatbuffers.Builder):
|
||||
TestSimpleTableWithEnumStart(builder)
|
||||
|
||||
def TestSimpleTableWithEnumAddColor(builder: flatbuffers.Builder, color: int):
|
||||
builder.PrependUint8Slot(0, color, 2)
|
||||
|
||||
def AddColor(builder: flatbuffers.Builder, color: int):
|
||||
TestSimpleTableWithEnumAddColor(builder, color)
|
||||
|
||||
def TestSimpleTableWithEnumEnd(builder: flatbuffers.Builder) -> int:
|
||||
return builder.EndObject()
|
||||
|
||||
def End(builder: flatbuffers.Builder) -> int:
|
||||
return TestSimpleTableWithEnumEnd(builder)
|
||||
|
||||
|
||||
class TestSimpleTableWithEnumT(object):
|
||||
|
||||
# TestSimpleTableWithEnumT
|
||||
def __init__(self):
|
||||
self.color = 2 # type: int
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
testSimpleTableWithEnum = TestSimpleTableWithEnum()
|
||||
testSimpleTableWithEnum.Init(buf, pos)
|
||||
return cls.InitFromObj(testSimpleTableWithEnum)
|
||||
|
||||
@classmethod
|
||||
def InitFromPackedBuf(cls, buf, pos=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
||||
return cls.InitFromBuf(buf, pos+n)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, testSimpleTableWithEnum):
|
||||
x = TestSimpleTableWithEnumT()
|
||||
x._UnPack(testSimpleTableWithEnum)
|
||||
return x
|
||||
|
||||
# TestSimpleTableWithEnumT
|
||||
def _UnPack(self, testSimpleTableWithEnum):
|
||||
if testSimpleTableWithEnum is None:
|
||||
return
|
||||
self.color = testSimpleTableWithEnum.Color()
|
||||
|
||||
# TestSimpleTableWithEnumT
|
||||
def Pack(self, builder):
|
||||
TestSimpleTableWithEnumStart(builder)
|
||||
TestSimpleTableWithEnumAddColor(builder, self.color)
|
||||
testSimpleTableWithEnum = TestSimpleTableWithEnumEnd(builder)
|
||||
return testSimpleTableWithEnum
|
||||
@@ -0,0 +1,181 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: NestedUnion
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
from typing import Any
|
||||
from MyGame.Example.NestedUnion.Test import Test
|
||||
from typing import Optional
|
||||
np = import_numpy()
|
||||
|
||||
class Vec3(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset: int = 0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = Vec3()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def GetRootAsVec3(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
# Vec3
|
||||
def Init(self, buf: bytes, pos: int):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# Vec3
|
||||
def X(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
|
||||
return 0.0
|
||||
|
||||
# Vec3
|
||||
def Y(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
|
||||
return 0.0
|
||||
|
||||
# Vec3
|
||||
def Z(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
|
||||
return 0.0
|
||||
|
||||
# Vec3
|
||||
def Test1(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
|
||||
return 0.0
|
||||
|
||||
# Vec3
|
||||
def Test2(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# Vec3
|
||||
def Test3(self) -> Optional[Test]:
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
||||
if o != 0:
|
||||
x = o + self._tab.Pos
|
||||
obj = Test()
|
||||
obj.Init(self._tab.Bytes, x)
|
||||
return obj
|
||||
return None
|
||||
|
||||
def Vec3Start(builder: flatbuffers.Builder):
|
||||
builder.StartObject(6)
|
||||
|
||||
def Start(builder: flatbuffers.Builder):
|
||||
Vec3Start(builder)
|
||||
|
||||
def Vec3AddX(builder: flatbuffers.Builder, x: float):
|
||||
builder.PrependFloat64Slot(0, x, 0.0)
|
||||
|
||||
def AddX(builder: flatbuffers.Builder, x: float):
|
||||
Vec3AddX(builder, x)
|
||||
|
||||
def Vec3AddY(builder: flatbuffers.Builder, y: float):
|
||||
builder.PrependFloat64Slot(1, y, 0.0)
|
||||
|
||||
def AddY(builder: flatbuffers.Builder, y: float):
|
||||
Vec3AddY(builder, y)
|
||||
|
||||
def Vec3AddZ(builder: flatbuffers.Builder, z: float):
|
||||
builder.PrependFloat64Slot(2, z, 0.0)
|
||||
|
||||
def AddZ(builder: flatbuffers.Builder, z: float):
|
||||
Vec3AddZ(builder, z)
|
||||
|
||||
def Vec3AddTest1(builder: flatbuffers.Builder, test1: float):
|
||||
builder.PrependFloat64Slot(3, test1, 0.0)
|
||||
|
||||
def AddTest1(builder: flatbuffers.Builder, test1: float):
|
||||
Vec3AddTest1(builder, test1)
|
||||
|
||||
def Vec3AddTest2(builder: flatbuffers.Builder, test2: int):
|
||||
builder.PrependUint8Slot(4, test2, 0)
|
||||
|
||||
def AddTest2(builder: flatbuffers.Builder, test2: int):
|
||||
Vec3AddTest2(builder, test2)
|
||||
|
||||
def Vec3AddTest3(builder: flatbuffers.Builder, test3: Any):
|
||||
builder.PrependStructSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(test3), 0)
|
||||
|
||||
def AddTest3(builder: flatbuffers.Builder, test3: Any):
|
||||
Vec3AddTest3(builder, test3)
|
||||
|
||||
def Vec3End(builder: flatbuffers.Builder) -> int:
|
||||
return builder.EndObject()
|
||||
|
||||
def End(builder: flatbuffers.Builder) -> int:
|
||||
return Vec3End(builder)
|
||||
|
||||
import MyGame.Example.NestedUnion.Test
|
||||
try:
|
||||
from typing import Optional
|
||||
except:
|
||||
pass
|
||||
|
||||
class Vec3T(object):
|
||||
|
||||
# Vec3T
|
||||
def __init__(self):
|
||||
self.x = 0.0 # type: float
|
||||
self.y = 0.0 # type: float
|
||||
self.z = 0.0 # type: float
|
||||
self.test1 = 0.0 # type: float
|
||||
self.test2 = 0 # type: int
|
||||
self.test3 = None # type: Optional[MyGame.Example.NestedUnion.Test.TestT]
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
vec3 = Vec3()
|
||||
vec3.Init(buf, pos)
|
||||
return cls.InitFromObj(vec3)
|
||||
|
||||
@classmethod
|
||||
def InitFromPackedBuf(cls, buf, pos=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
||||
return cls.InitFromBuf(buf, pos+n)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, vec3):
|
||||
x = Vec3T()
|
||||
x._UnPack(vec3)
|
||||
return x
|
||||
|
||||
# Vec3T
|
||||
def _UnPack(self, vec3):
|
||||
if vec3 is None:
|
||||
return
|
||||
self.x = vec3.X()
|
||||
self.y = vec3.Y()
|
||||
self.z = vec3.Z()
|
||||
self.test1 = vec3.Test1()
|
||||
self.test2 = vec3.Test2()
|
||||
if vec3.Test3() is not None:
|
||||
self.test3 = MyGame.Example.NestedUnion.Test.TestT.InitFromObj(vec3.Test3())
|
||||
|
||||
# Vec3T
|
||||
def Pack(self, builder):
|
||||
Vec3Start(builder)
|
||||
Vec3AddX(builder, self.x)
|
||||
Vec3AddY(builder, self.y)
|
||||
Vec3AddZ(builder, self.z)
|
||||
Vec3AddTest1(builder, self.test1)
|
||||
Vec3AddTest2(builder, self.test2)
|
||||
if self.test3 is not None:
|
||||
test3 = self.test3.Pack(builder)
|
||||
Vec3AddTest3(builder, test3)
|
||||
vec3 = Vec3End(builder)
|
||||
return vec3
|
||||
@@ -0,0 +1,18 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||
public enum Race : sbyte
|
||||
{
|
||||
None = -1,
|
||||
Human = 0,
|
||||
Dwarf = 1,
|
||||
Elf = 2,
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package Example
|
||||
|
||||
import "strconv"
|
||||
|
||||
type Race int8
|
||||
|
||||
const (
|
||||
RaceNone Race = -1
|
||||
RaceHuman Race = 0
|
||||
RaceDwarf Race = 1
|
||||
RaceElf Race = 2
|
||||
)
|
||||
|
||||
var EnumNamesRace = map[Race]string{
|
||||
RaceNone: "None",
|
||||
RaceHuman: "Human",
|
||||
RaceDwarf: "Dwarf",
|
||||
RaceElf: "Elf",
|
||||
}
|
||||
|
||||
var EnumValuesRace = map[string]Race{
|
||||
"None": RaceNone,
|
||||
"Human": RaceHuman,
|
||||
"Dwarf": RaceDwarf,
|
||||
"Elf": RaceElf,
|
||||
}
|
||||
|
||||
func (v Race) String() string {
|
||||
if s, ok := EnumNamesRace[v]; ok {
|
||||
return s
|
||||
}
|
||||
return "Race(" + strconv.FormatInt(int64(v), 10) + ")"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class Race {
|
||||
private Race() { }
|
||||
public static final byte None = -1;
|
||||
public static final byte Human = 0;
|
||||
public static final byte Dwarf = 1;
|
||||
public static final byte Elf = 2;
|
||||
|
||||
public static final String[] names = { "None", "Human", "Dwarf", "Elf", };
|
||||
|
||||
public static String name(int e) { return names[e - None]; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example
|
||||
|
||||
@Suppress("unused")
|
||||
class Race private constructor() {
|
||||
companion object {
|
||||
const val None: Byte = -1
|
||||
const val Human: Byte = 0
|
||||
const val Dwarf: Byte = 1
|
||||
const val Elf: Byte = 2
|
||||
val names : Array<String> = arrayOf("None", "Human", "Dwarf", "Elf")
|
||||
fun name(e: Int) : String = names[e - None.toInt()]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--[[ MyGame.Example.Race
|
||||
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by : //monster_test.fbs
|
||||
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
|
||||
|
||||
--]]
|
||||
|
||||
local Race = {
|
||||
None = -1,
|
||||
Human = 0,
|
||||
Dwarf = 1,
|
||||
Elf = 2,
|
||||
}
|
||||
|
||||
return Race
|
||||
@@ -0,0 +1,15 @@
|
||||
#[ MyGame.Example.Race
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by :
|
||||
Rooting type : MyGame.Example.Monster ()
|
||||
]#
|
||||
|
||||
type Race*{.pure.} = enum
|
||||
None = -1.int8,
|
||||
Human = 0.int8,
|
||||
Dwarf = 1.int8,
|
||||
Elf = 2.int8,
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace MyGame\Example;
|
||||
|
||||
class Race
|
||||
{
|
||||
const None = -1;
|
||||
const Human = 0;
|
||||
const Dwarf = 1;
|
||||
const Elf = 2;
|
||||
|
||||
private static $names = array(
|
||||
Race::None=>"None",
|
||||
Race::Human=>"Human",
|
||||
Race::Dwarf=>"Dwarf",
|
||||
Race::Elf=>"Elf",
|
||||
);
|
||||
|
||||
public static function Name($e)
|
||||
{
|
||||
if (!isset(self::$names[$e])) {
|
||||
throw new \Exception();
|
||||
}
|
||||
return self::$names[$e];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
class Race(object):
|
||||
None_ = -1
|
||||
Human = 0
|
||||
Dwarf = 1
|
||||
Elf = 2
|
||||
@@ -0,0 +1,105 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct Referrable : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_24_3_25(); }
|
||||
public static Referrable GetRootAsReferrable(ByteBuffer _bb) { return GetRootAsReferrable(_bb, new Referrable()); }
|
||||
public static Referrable GetRootAsReferrable(ByteBuffer _bb, Referrable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||
public Referrable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public ulong Id { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUlong(o + __p.bb_pos) : (ulong)0; } }
|
||||
public bool MutateId(ulong id) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutUlong(o + __p.bb_pos, id); return true; } else { return false; } }
|
||||
|
||||
public static Offset<MyGame.Example.Referrable> CreateReferrable(FlatBufferBuilder builder,
|
||||
ulong id = 0) {
|
||||
builder.StartTable(1);
|
||||
Referrable.AddId(builder, id);
|
||||
return Referrable.EndReferrable(builder);
|
||||
}
|
||||
|
||||
public static void StartReferrable(FlatBufferBuilder builder) { builder.StartTable(1); }
|
||||
public static void AddId(FlatBufferBuilder builder, ulong id) { builder.AddUlong(0, id, 0); }
|
||||
public static Offset<MyGame.Example.Referrable> EndReferrable(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<MyGame.Example.Referrable>(o);
|
||||
}
|
||||
|
||||
public static VectorOffset CreateSortedVectorOfReferrable(FlatBufferBuilder builder, Offset<Referrable>[] offsets) {
|
||||
Array.Sort(offsets,
|
||||
(Offset<Referrable> o1, Offset<Referrable> o2) =>
|
||||
new Referrable().__assign(builder.DataBuffer.Length - o1.Value, builder.DataBuffer).Id.CompareTo(new Referrable().__assign(builder.DataBuffer.Length - o2.Value, builder.DataBuffer).Id));
|
||||
return builder.CreateVectorOfTables(offsets);
|
||||
}
|
||||
|
||||
public static Referrable? __lookup_by_key(int vectorLocation, ulong key, ByteBuffer bb) {
|
||||
Referrable obj_ = new Referrable();
|
||||
int span = bb.GetInt(vectorLocation - 4);
|
||||
int start = 0;
|
||||
while (span != 0) {
|
||||
int middle = span / 2;
|
||||
int tableOffset = Table.__indirect(vectorLocation + 4 * (start + middle), bb);
|
||||
obj_.__assign(tableOffset, bb);
|
||||
int comp = obj_.Id.CompareTo(key);
|
||||
if (comp > 0) {
|
||||
span = middle;
|
||||
} else if (comp < 0) {
|
||||
middle++;
|
||||
start += middle;
|
||||
span -= middle;
|
||||
} else {
|
||||
return obj_;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public ReferrableT UnPack() {
|
||||
var _o = new ReferrableT();
|
||||
this.UnPackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void UnPackTo(ReferrableT _o) {
|
||||
_o.Id = this.Id;
|
||||
}
|
||||
public static Offset<MyGame.Example.Referrable> Pack(FlatBufferBuilder builder, ReferrableT _o) {
|
||||
if (_o == null) return default(Offset<MyGame.Example.Referrable>);
|
||||
return CreateReferrable(
|
||||
builder,
|
||||
_o.Id);
|
||||
}
|
||||
}
|
||||
|
||||
public class ReferrableT
|
||||
{
|
||||
[Newtonsoft.Json.JsonProperty("id")]
|
||||
[Newtonsoft.Json.JsonIgnore()]
|
||||
public ulong Id { get; set; }
|
||||
|
||||
public ReferrableT() {
|
||||
this.Id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public class ReferrableVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
|
||||
{
|
||||
return verifier.VerifyTableStart(tablePos)
|
||||
&& verifier.VerifyField(tablePos, 4 /*Id*/, 8 /*ulong*/, 8, false)
|
||||
&& verifier.VerifyTableEnd(tablePos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
|
||||
|
||||
package Example
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
)
|
||||
|
||||
type ReferrableT struct {
|
||||
Id uint64 `json:"id"`
|
||||
}
|
||||
|
||||
func (t *ReferrableT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil {
|
||||
return 0
|
||||
}
|
||||
ReferrableStart(builder)
|
||||
ReferrableAddId(builder, t.Id)
|
||||
return ReferrableEnd(builder)
|
||||
}
|
||||
|
||||
func (rcv *Referrable) UnPackTo(t *ReferrableT) {
|
||||
t.Id = rcv.Id()
|
||||
}
|
||||
|
||||
func (rcv *Referrable) UnPack() *ReferrableT {
|
||||
if rcv == nil {
|
||||
return nil
|
||||
}
|
||||
t := &ReferrableT{}
|
||||
rcv.UnPackTo(t)
|
||||
return t
|
||||
}
|
||||
|
||||
type Referrable struct {
|
||||
_tab flatbuffers.Table
|
||||
}
|
||||
|
||||
func GetRootAsReferrable(buf []byte, offset flatbuffers.UOffsetT) *Referrable {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset:])
|
||||
x := &Referrable{}
|
||||
x.Init(buf, n+offset)
|
||||
return x
|
||||
}
|
||||
|
||||
func FinishReferrableBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
|
||||
builder.Finish(offset)
|
||||
}
|
||||
|
||||
func GetSizePrefixedRootAsReferrable(buf []byte, offset flatbuffers.UOffsetT) *Referrable {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
|
||||
x := &Referrable{}
|
||||
x.Init(buf, n+offset+flatbuffers.SizeUint32)
|
||||
return x
|
||||
}
|
||||
|
||||
func FinishSizePrefixedReferrableBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
|
||||
builder.FinishSizePrefixed(offset)
|
||||
}
|
||||
|
||||
func (rcv *Referrable) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *Referrable) Table() flatbuffers.Table {
|
||||
return rcv._tab
|
||||
}
|
||||
|
||||
func (rcv *Referrable) Id() uint64 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetUint64(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *Referrable) MutateId(n uint64) bool {
|
||||
return rcv._tab.MutateUint64Slot(4, n)
|
||||
}
|
||||
|
||||
func ReferrableKeyCompare(o1, o2 flatbuffers.UOffsetT, buf []byte) bool {
|
||||
obj1 := &Referrable{}
|
||||
obj2 := &Referrable{}
|
||||
obj1.Init(buf, flatbuffers.UOffsetT(len(buf))-o1)
|
||||
obj2.Init(buf, flatbuffers.UOffsetT(len(buf))-o2)
|
||||
return obj1.Id() < obj2.Id()
|
||||
}
|
||||
|
||||
func (rcv *Referrable) LookupByKey(key uint64, vectorLocation flatbuffers.UOffsetT, buf []byte) bool {
|
||||
span := flatbuffers.GetUOffsetT(buf[vectorLocation-4:])
|
||||
start := flatbuffers.UOffsetT(0)
|
||||
for span != 0 {
|
||||
middle := span / 2
|
||||
tableOffset := flatbuffers.GetIndirectOffset(buf, vectorLocation+4*(start+middle))
|
||||
obj := &Referrable{}
|
||||
obj.Init(buf, tableOffset)
|
||||
val := obj.Id()
|
||||
comp := 0
|
||||
if val > key {
|
||||
comp = 1
|
||||
} else if val < key {
|
||||
comp = -1
|
||||
}
|
||||
if comp > 0 {
|
||||
span = middle
|
||||
} else if comp < 0 {
|
||||
middle += 1
|
||||
start += middle
|
||||
span -= middle
|
||||
} else {
|
||||
rcv.Init(buf, tableOffset)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func ReferrableStart(builder *flatbuffers.Builder) {
|
||||
builder.StartObject(1)
|
||||
}
|
||||
func ReferrableAddId(builder *flatbuffers.Builder, id uint64) {
|
||||
builder.PrependUint64Slot(0, id, 0)
|
||||
}
|
||||
func ReferrableEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
return builder.EndObject()
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class Referrable extends Table {
|
||||
public static void ValidateVersion() { Constants.FLATBUFFERS_24_3_25(); }
|
||||
public static Referrable getRootAsReferrable(ByteBuffer _bb) { return getRootAsReferrable(_bb, new Referrable()); }
|
||||
public static Referrable getRootAsReferrable(ByteBuffer _bb, Referrable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
|
||||
public Referrable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public long id() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public boolean mutateId(long id) { int o = __offset(4); if (o != 0) { bb.putLong(o + bb_pos, id); return true; } else { return false; } }
|
||||
|
||||
public static int createReferrable(FlatBufferBuilder builder,
|
||||
long id) {
|
||||
builder.startTable(1);
|
||||
Referrable.addId(builder, id);
|
||||
return Referrable.endReferrable(builder);
|
||||
}
|
||||
|
||||
public static void startReferrable(FlatBufferBuilder builder) { builder.startTable(1); }
|
||||
public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(id); builder.slot(0); }
|
||||
public static int endReferrable(FlatBufferBuilder builder) {
|
||||
int o = builder.endTable();
|
||||
return o;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int keysCompare(Integer o1, Integer o2, ByteBuffer _bb) {
|
||||
long val_1 = _bb.getLong(__offset(4, o1, _bb));
|
||||
long val_2 = _bb.getLong(__offset(4, o2, _bb));
|
||||
return val_1 > val_2 ? 1 : val_1 < val_2 ? -1 : 0;
|
||||
}
|
||||
|
||||
public static Referrable __lookup_by_key(Referrable obj, int vectorLocation, long key, ByteBuffer bb) {
|
||||
int span = bb.getInt(vectorLocation - 4);
|
||||
int start = 0;
|
||||
while (span != 0) {
|
||||
int middle = span / 2;
|
||||
int tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb);
|
||||
long val = bb.getLong(__offset(4, bb.capacity() - tableOffset, bb));
|
||||
int comp = val > key ? 1 : val < key ? -1 : 0;
|
||||
if (comp > 0) {
|
||||
span = middle;
|
||||
} else if (comp < 0) {
|
||||
middle++;
|
||||
start += middle;
|
||||
span -= middle;
|
||||
} else {
|
||||
return (obj == null ? new Referrable() : obj).__assign(tableOffset, bb);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
|
||||
|
||||
public Referrable get(int j) { return get(new Referrable(), j); }
|
||||
public Referrable get(Referrable obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
|
||||
public Referrable getByKey(long key) { return __lookup_by_key(null, __vector(), key, bb); }
|
||||
public Referrable getByKey(Referrable obj, long key) { return __lookup_by_key(obj, __vector(), key, bb); }
|
||||
}
|
||||
public ReferrableT unpack() {
|
||||
ReferrableT _o = new ReferrableT();
|
||||
unpackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void unpackTo(ReferrableT _o) {
|
||||
long _oId = id();
|
||||
_o.setId(_oId);
|
||||
}
|
||||
public static int pack(FlatBufferBuilder builder, ReferrableT _o) {
|
||||
if (_o == null) return 0;
|
||||
return createReferrable(
|
||||
builder,
|
||||
_o.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example
|
||||
|
||||
import com.google.flatbuffers.BaseVector
|
||||
import com.google.flatbuffers.BooleanVector
|
||||
import com.google.flatbuffers.ByteVector
|
||||
import com.google.flatbuffers.Constants
|
||||
import com.google.flatbuffers.DoubleVector
|
||||
import com.google.flatbuffers.FlatBufferBuilder
|
||||
import com.google.flatbuffers.FloatVector
|
||||
import com.google.flatbuffers.LongVector
|
||||
import com.google.flatbuffers.StringVector
|
||||
import com.google.flatbuffers.Struct
|
||||
import com.google.flatbuffers.Table
|
||||
import com.google.flatbuffers.UnionVector
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
import kotlin.math.sign
|
||||
|
||||
@Suppress("unused")
|
||||
class Referrable : Table() {
|
||||
|
||||
fun __init(_i: Int, _bb: ByteBuffer) {
|
||||
__reset(_i, _bb)
|
||||
}
|
||||
fun __assign(_i: Int, _bb: ByteBuffer) : Referrable {
|
||||
__init(_i, _bb)
|
||||
return this
|
||||
}
|
||||
val id : ULong
|
||||
get() {
|
||||
val o = __offset(4)
|
||||
return if(o != 0) bb.getLong(o + bb_pos).toULong() else 0UL
|
||||
}
|
||||
fun mutateId(id: ULong) : Boolean {
|
||||
val o = __offset(4)
|
||||
return if (o != 0) {
|
||||
bb.putLong(o + bb_pos, id.toLong())
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
override fun keysCompare(o1: Int, o2: Int, _bb: ByteBuffer) : Int {
|
||||
val val_1 = _bb.getLong(__offset(4, o1, _bb))
|
||||
val val_2 = _bb.getLong(__offset(4, o2, _bb))
|
||||
return (val_1 - val_2).sign
|
||||
}
|
||||
companion object {
|
||||
fun validateVersion() = Constants.FLATBUFFERS_24_3_25()
|
||||
fun getRootAsReferrable(_bb: ByteBuffer): Referrable = getRootAsReferrable(_bb, Referrable())
|
||||
fun getRootAsReferrable(_bb: ByteBuffer, obj: Referrable): Referrable {
|
||||
_bb.order(ByteOrder.LITTLE_ENDIAN)
|
||||
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
|
||||
}
|
||||
fun createReferrable(builder: FlatBufferBuilder, id: ULong) : Int {
|
||||
builder.startTable(1)
|
||||
addId(builder, id)
|
||||
return endReferrable(builder)
|
||||
}
|
||||
fun startReferrable(builder: FlatBufferBuilder) = builder.startTable(1)
|
||||
fun addId(builder: FlatBufferBuilder, id: ULong) {
|
||||
builder.addLong(id.toLong())
|
||||
builder.slot(0)
|
||||
}
|
||||
fun endReferrable(builder: FlatBufferBuilder) : Int {
|
||||
val o = builder.endTable()
|
||||
return o
|
||||
}
|
||||
fun __lookup_by_key(obj: Referrable?, vectorLocation: Int, key: ULong, bb: ByteBuffer) : Referrable? {
|
||||
var span = bb.getInt(vectorLocation - 4)
|
||||
var start = 0
|
||||
while (span != 0) {
|
||||
var middle = span / 2
|
||||
val tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb)
|
||||
val value = bb.getLong(__offset(4, bb.capacity() - tableOffset, bb)).toULong()
|
||||
val comp = value.compareTo(key)
|
||||
when {
|
||||
comp > 0 -> span = middle
|
||||
comp < 0 -> {
|
||||
middle++
|
||||
start += middle
|
||||
span -= middle
|
||||
}
|
||||
else -> {
|
||||
return (obj ?: Referrable()).__assign(tableOffset, bb)
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
--[[ MyGame.Example.Referrable
|
||||
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by : //monster_test.fbs
|
||||
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
|
||||
|
||||
--]]
|
||||
|
||||
local flatbuffers = require('flatbuffers')
|
||||
|
||||
local Referrable = {}
|
||||
local mt = {}
|
||||
|
||||
function Referrable.New()
|
||||
local o = {}
|
||||
setmetatable(o, {__index = mt})
|
||||
return o
|
||||
end
|
||||
|
||||
function mt:Init(buf, pos)
|
||||
self.view = flatbuffers.view.New(buf, pos)
|
||||
end
|
||||
|
||||
function mt:Id()
|
||||
local o = self.view:Offset(4)
|
||||
if o ~= 0 then
|
||||
return self.view:Get(flatbuffers.N.Uint64, self.view.pos + o)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function Referrable.Start(builder)
|
||||
builder:StartObject(1)
|
||||
end
|
||||
|
||||
function Referrable.AddId(builder, id)
|
||||
builder:PrependUint64Slot(0, id, 0)
|
||||
end
|
||||
|
||||
function Referrable.End(builder)
|
||||
return builder:EndObject()
|
||||
end
|
||||
|
||||
return Referrable
|
||||
@@ -0,0 +1,26 @@
|
||||
#[ MyGame.Example.Referrable
|
||||
Automatically generated by the FlatBuffers compiler, do not modify.
|
||||
Or modify. I'm a message, not a cop.
|
||||
|
||||
flatc version: 24.3.25
|
||||
|
||||
Declared by :
|
||||
Rooting type : MyGame.Example.Monster ()
|
||||
]#
|
||||
|
||||
import flatbuffers
|
||||
|
||||
type Referrable* = object of FlatObj
|
||||
func id*(self: Referrable): uint64 =
|
||||
let o = self.tab.Offset(4)
|
||||
if o != 0:
|
||||
return Get[uint64](self.tab, self.tab.Pos + o)
|
||||
return 0
|
||||
func `id=`*(self: var Referrable, n: uint64): bool =
|
||||
return self.tab.MutateSlot(4, n)
|
||||
proc ReferrableStart*(builder: var Builder) =
|
||||
builder.StartObject(1)
|
||||
proc ReferrableAddid*(builder: var Builder, id: uint64) =
|
||||
builder.PrependSlot(0, id, default(uint64))
|
||||
proc ReferrableEnd*(builder: var Builder): uoffset =
|
||||
return builder.EndObject()
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace MyGame\Example;
|
||||
|
||||
use \Google\FlatBuffers\Struct;
|
||||
use \Google\FlatBuffers\Table;
|
||||
use \Google\FlatBuffers\ByteBuffer;
|
||||
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||
|
||||
class Referrable extends Table
|
||||
{
|
||||
/**
|
||||
* @param ByteBuffer $bb
|
||||
* @return Referrable
|
||||
*/
|
||||
public static function getRootAsReferrable(ByteBuffer $bb)
|
||||
{
|
||||
$obj = new Referrable();
|
||||
return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
|
||||
}
|
||||
|
||||
public static function ReferrableIdentifier()
|
||||
{
|
||||
return "MONS";
|
||||
}
|
||||
|
||||
public static function ReferrableBufferHasIdentifier(ByteBuffer $buf)
|
||||
{
|
||||
return self::__has_identifier($buf, self::ReferrableIdentifier());
|
||||
}
|
||||
|
||||
public static function ReferrableExtension()
|
||||
{
|
||||
return "mon";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $_i offset
|
||||
* @param ByteBuffer $_bb
|
||||
* @return Referrable
|
||||
**/
|
||||
public function init($_i, ByteBuffer $_bb)
|
||||
{
|
||||
$this->bb_pos = $_i;
|
||||
$this->bb = $_bb;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ulong
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
$o = $this->__offset(4);
|
||||
return $o != 0 ? $this->bb->getUlong($o + $this->bb_pos) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return void
|
||||
*/
|
||||
public static function startReferrable(FlatBufferBuilder $builder)
|
||||
{
|
||||
$builder->StartObject(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return Referrable
|
||||
*/
|
||||
public static function createReferrable(FlatBufferBuilder $builder, $id)
|
||||
{
|
||||
$builder->startObject(1);
|
||||
self::addId($builder, $id);
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param ulong
|
||||
* @return void
|
||||
*/
|
||||
public static function addId(FlatBufferBuilder $builder, $id)
|
||||
{
|
||||
$builder->addUlongX(0, $id, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return int table offset
|
||||
*/
|
||||
public static function endReferrable(FlatBufferBuilder $builder)
|
||||
{
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
import flatbuffers
|
||||
from flatbuffers.compat import import_numpy
|
||||
np = import_numpy()
|
||||
|
||||
class Referrable(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAs(cls, buf, offset=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = Referrable()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def GetRootAsReferrable(cls, buf, offset=0):
|
||||
"""This method is deprecated. Please switch to GetRootAs."""
|
||||
return cls.GetRootAs(buf, offset)
|
||||
@classmethod
|
||||
def ReferrableBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
|
||||
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed)
|
||||
|
||||
# Referrable
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# Referrable
|
||||
def Id(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
def ReferrableStart(builder):
|
||||
builder.StartObject(1)
|
||||
|
||||
def Start(builder):
|
||||
ReferrableStart(builder)
|
||||
|
||||
def ReferrableAddId(builder, id):
|
||||
builder.PrependUint64Slot(0, id, 0)
|
||||
|
||||
def AddId(builder, id):
|
||||
ReferrableAddId(builder, id)
|
||||
|
||||
def ReferrableEnd(builder):
|
||||
return builder.EndObject()
|
||||
|
||||
def End(builder):
|
||||
return ReferrableEnd(builder)
|
||||
|
||||
|
||||
class ReferrableT(object):
|
||||
|
||||
# ReferrableT
|
||||
def __init__(self):
|
||||
self.id = 0 # type: int
|
||||
|
||||
@classmethod
|
||||
def InitFromBuf(cls, buf, pos):
|
||||
referrable = Referrable()
|
||||
referrable.Init(buf, pos)
|
||||
return cls.InitFromObj(referrable)
|
||||
|
||||
@classmethod
|
||||
def InitFromPackedBuf(cls, buf, pos=0):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
||||
return cls.InitFromBuf(buf, pos+n)
|
||||
|
||||
@classmethod
|
||||
def InitFromObj(cls, referrable):
|
||||
x = ReferrableT()
|
||||
x._UnPack(referrable)
|
||||
return x
|
||||
|
||||
# ReferrableT
|
||||
def _UnPack(self, referrable):
|
||||
if referrable is None:
|
||||
return
|
||||
self.id = referrable.Id()
|
||||
|
||||
# ReferrableT
|
||||
def Pack(self, builder):
|
||||
ReferrableStart(builder)
|
||||
ReferrableAddId(builder, self.id)
|
||||
referrable = ReferrableEnd(builder)
|
||||
return referrable
|
||||
@@ -0,0 +1,34 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import com.google.flatbuffers.BaseVector;
|
||||
import com.google.flatbuffers.BooleanVector;
|
||||
import com.google.flatbuffers.ByteVector;
|
||||
import com.google.flatbuffers.Constants;
|
||||
import com.google.flatbuffers.DoubleVector;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
import com.google.flatbuffers.FloatVector;
|
||||
import com.google.flatbuffers.IntVector;
|
||||
import com.google.flatbuffers.LongVector;
|
||||
import com.google.flatbuffers.ShortVector;
|
||||
import com.google.flatbuffers.StringVector;
|
||||
import com.google.flatbuffers.Struct;
|
||||
import com.google.flatbuffers.Table;
|
||||
import com.google.flatbuffers.UnionVector;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
public class ReferrableT {
|
||||
private long id;
|
||||
|
||||
public long getId() { return id; }
|
||||
|
||||
public void setId(long id) { this.id = id; }
|
||||
|
||||
|
||||
public ReferrableT() {
|
||||
this.id = 0L;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct Stat : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_24_3_25(); }
|
||||
public static Stat GetRootAsStat(ByteBuffer _bb) { return GetRootAsStat(_bb, new Stat()); }
|
||||
public static Stat GetRootAsStat(ByteBuffer _bb, Stat obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||
public Stat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public string Id { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
|
||||
#if ENABLE_SPAN_T
|
||||
public Span<byte> GetIdBytes() { return __p.__vector_as_span<byte>(4, 1); }
|
||||
#else
|
||||
public ArraySegment<byte>? GetIdBytes() { return __p.__vector_as_arraysegment(4); }
|
||||
#endif
|
||||
public byte[] GetIdArray() { return __p.__vector_as_array<byte>(4); }
|
||||
public long Val { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetLong(o + __p.bb_pos) : (long)0; } }
|
||||
public bool MutateVal(long val) { int o = __p.__offset(6); if (o != 0) { __p.bb.PutLong(o + __p.bb_pos, val); return true; } else { return false; } }
|
||||
public ushort Count { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetUshort(o + __p.bb_pos) : (ushort)0; } }
|
||||
public bool MutateCount(ushort count) { int o = __p.__offset(8); if (o != 0) { __p.bb.PutUshort(o + __p.bb_pos, count); return true; } else { return false; } }
|
||||
|
||||
public static Offset<MyGame.Example.Stat> CreateStat(FlatBufferBuilder builder,
|
||||
StringOffset idOffset = default(StringOffset),
|
||||
long val = 0,
|
||||
ushort count = 0) {
|
||||
builder.StartTable(3);
|
||||
Stat.AddVal(builder, val);
|
||||
Stat.AddId(builder, idOffset);
|
||||
Stat.AddCount(builder, count);
|
||||
return Stat.EndStat(builder);
|
||||
}
|
||||
|
||||
public static void StartStat(FlatBufferBuilder builder) { builder.StartTable(3); }
|
||||
public static void AddId(FlatBufferBuilder builder, StringOffset idOffset) { builder.AddOffset(0, idOffset.Value, 0); }
|
||||
public static void AddVal(FlatBufferBuilder builder, long val) { builder.AddLong(1, val, 0); }
|
||||
public static void AddCount(FlatBufferBuilder builder, ushort count) { builder.AddUshort(2, count, 0); }
|
||||
public static Offset<MyGame.Example.Stat> EndStat(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<MyGame.Example.Stat>(o);
|
||||
}
|
||||
|
||||
public static VectorOffset CreateSortedVectorOfStat(FlatBufferBuilder builder, Offset<Stat>[] offsets) {
|
||||
Array.Sort(offsets,
|
||||
(Offset<Stat> o1, Offset<Stat> o2) =>
|
||||
new Stat().__assign(builder.DataBuffer.Length - o1.Value, builder.DataBuffer).Count.CompareTo(new Stat().__assign(builder.DataBuffer.Length - o2.Value, builder.DataBuffer).Count));
|
||||
return builder.CreateVectorOfTables(offsets);
|
||||
}
|
||||
|
||||
public static Stat? __lookup_by_key(int vectorLocation, ushort key, ByteBuffer bb) {
|
||||
Stat obj_ = new Stat();
|
||||
int span = bb.GetInt(vectorLocation - 4);
|
||||
int start = 0;
|
||||
while (span != 0) {
|
||||
int middle = span / 2;
|
||||
int tableOffset = Table.__indirect(vectorLocation + 4 * (start + middle), bb);
|
||||
obj_.__assign(tableOffset, bb);
|
||||
int comp = obj_.Count.CompareTo(key);
|
||||
if (comp > 0) {
|
||||
span = middle;
|
||||
} else if (comp < 0) {
|
||||
middle++;
|
||||
start += middle;
|
||||
span -= middle;
|
||||
} else {
|
||||
return obj_;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public StatT UnPack() {
|
||||
var _o = new StatT();
|
||||
this.UnPackTo(_o);
|
||||
return _o;
|
||||
}
|
||||
public void UnPackTo(StatT _o) {
|
||||
_o.Id = this.Id;
|
||||
_o.Val = this.Val;
|
||||
_o.Count = this.Count;
|
||||
}
|
||||
public static Offset<MyGame.Example.Stat> Pack(FlatBufferBuilder builder, StatT _o) {
|
||||
if (_o == null) return default(Offset<MyGame.Example.Stat>);
|
||||
var _id = _o.Id == null ? default(StringOffset) : builder.CreateString(_o.Id);
|
||||
return CreateStat(
|
||||
builder,
|
||||
_id,
|
||||
_o.Val,
|
||||
_o.Count);
|
||||
}
|
||||
}
|
||||
|
||||
public class StatT
|
||||
{
|
||||
[Newtonsoft.Json.JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("val")]
|
||||
public long Val { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("count")]
|
||||
public ushort Count { get; set; }
|
||||
|
||||
public StatT() {
|
||||
this.Id = null;
|
||||
this.Val = 0;
|
||||
this.Count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public class StatVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
|
||||
{
|
||||
return verifier.VerifyTableStart(tablePos)
|
||||
&& verifier.VerifyString(tablePos, 4 /*Id*/, false)
|
||||
&& verifier.VerifyField(tablePos, 6 /*Val*/, 8 /*long*/, 8, false)
|
||||
&& verifier.VerifyField(tablePos, 8 /*Count*/, 2 /*ushort*/, 2, false)
|
||||
&& verifier.VerifyTableEnd(tablePos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user