203 lines
7.5 KiB
Kotlin
203 lines
7.5 KiB
Kotlin
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||
|
|
||
|
package MyGame
|
||
|
|
||
|
import java.nio.*
|
||
|
import kotlin.math.sign
|
||
|
import com.google.flatbuffers.*
|
||
|
|
||
|
@Suppress("unused")
|
||
|
@ExperimentalUnsignedTypes
|
||
|
class MonsterExtra : Table() {
|
||
|
|
||
|
fun __init(_i: Int, _bb: ByteBuffer) {
|
||
|
__reset(_i, _bb)
|
||
|
}
|
||
|
fun __assign(_i: Int, _bb: ByteBuffer) : MonsterExtra {
|
||
|
__init(_i, _bb)
|
||
|
return this
|
||
|
}
|
||
|
val testfNan : Float
|
||
|
get() {
|
||
|
val o = __offset(4)
|
||
|
return if(o != 0) bb.getFloat(o + bb_pos) else Float.NaN
|
||
|
}
|
||
|
fun mutateTestfNan(testfNan: Float) : Boolean {
|
||
|
val o = __offset(4)
|
||
|
return if (o != 0) {
|
||
|
bb.putFloat(o + bb_pos, testfNan)
|
||
|
true
|
||
|
} else {
|
||
|
false
|
||
|
}
|
||
|
}
|
||
|
val testfPinf : Float
|
||
|
get() {
|
||
|
val o = __offset(6)
|
||
|
return if(o != 0) bb.getFloat(o + bb_pos) else Float.POSITIVE_INFINITY
|
||
|
}
|
||
|
fun mutateTestfPinf(testfPinf: Float) : Boolean {
|
||
|
val o = __offset(6)
|
||
|
return if (o != 0) {
|
||
|
bb.putFloat(o + bb_pos, testfPinf)
|
||
|
true
|
||
|
} else {
|
||
|
false
|
||
|
}
|
||
|
}
|
||
|
val testfNinf : Float
|
||
|
get() {
|
||
|
val o = __offset(8)
|
||
|
return if(o != 0) bb.getFloat(o + bb_pos) else Float.NEGATIVE_INFINITY
|
||
|
}
|
||
|
fun mutateTestfNinf(testfNinf: Float) : Boolean {
|
||
|
val o = __offset(8)
|
||
|
return if (o != 0) {
|
||
|
bb.putFloat(o + bb_pos, testfNinf)
|
||
|
true
|
||
|
} else {
|
||
|
false
|
||
|
}
|
||
|
}
|
||
|
val testdNan : Double
|
||
|
get() {
|
||
|
val o = __offset(10)
|
||
|
return if(o != 0) bb.getDouble(o + bb_pos) else Double.NaN
|
||
|
}
|
||
|
fun mutateTestdNan(testdNan: Double) : Boolean {
|
||
|
val o = __offset(10)
|
||
|
return if (o != 0) {
|
||
|
bb.putDouble(o + bb_pos, testdNan)
|
||
|
true
|
||
|
} else {
|
||
|
false
|
||
|
}
|
||
|
}
|
||
|
val testdPinf : Double
|
||
|
get() {
|
||
|
val o = __offset(12)
|
||
|
return if(o != 0) bb.getDouble(o + bb_pos) else Double.POSITIVE_INFINITY
|
||
|
}
|
||
|
fun mutateTestdPinf(testdPinf: Double) : Boolean {
|
||
|
val o = __offset(12)
|
||
|
return if (o != 0) {
|
||
|
bb.putDouble(o + bb_pos, testdPinf)
|
||
|
true
|
||
|
} else {
|
||
|
false
|
||
|
}
|
||
|
}
|
||
|
val testdNinf : Double
|
||
|
get() {
|
||
|
val o = __offset(14)
|
||
|
return if(o != 0) bb.getDouble(o + bb_pos) else Double.NEGATIVE_INFINITY
|
||
|
}
|
||
|
fun mutateTestdNinf(testdNinf: Double) : Boolean {
|
||
|
val o = __offset(14)
|
||
|
return if (o != 0) {
|
||
|
bb.putDouble(o + bb_pos, testdNinf)
|
||
|
true
|
||
|
} else {
|
||
|
false
|
||
|
}
|
||
|
}
|
||
|
fun testfVec(j: Int) : Float {
|
||
|
val o = __offset(16)
|
||
|
return if (o != 0) {
|
||
|
bb.getFloat(__vector(o) + j * 4)
|
||
|
} else {
|
||
|
0.0f
|
||
|
}
|
||
|
}
|
||
|
val testfVecLength : Int
|
||
|
get() {
|
||
|
val o = __offset(16); return if (o != 0) __vector_len(o) else 0
|
||
|
}
|
||
|
val testfVecAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(16, 4)
|
||
|
fun testfVecInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 16, 4)
|
||
|
fun mutateTestfVec(j: Int, testfVec: Float) : Boolean {
|
||
|
val o = __offset(16)
|
||
|
return if (o != 0) {
|
||
|
bb.putFloat(__vector(o) + j * 4, testfVec)
|
||
|
true
|
||
|
} else {
|
||
|
false
|
||
|
}
|
||
|
}
|
||
|
fun testdVec(j: Int) : Double {
|
||
|
val o = __offset(18)
|
||
|
return if (o != 0) {
|
||
|
bb.getDouble(__vector(o) + j * 8)
|
||
|
} else {
|
||
|
0.0
|
||
|
}
|
||
|
}
|
||
|
val testdVecLength : Int
|
||
|
get() {
|
||
|
val o = __offset(18); return if (o != 0) __vector_len(o) else 0
|
||
|
}
|
||
|
val testdVecAsByteBuffer : ByteBuffer get() = __vector_as_bytebuffer(18, 8)
|
||
|
fun testdVecInByteBuffer(_bb: ByteBuffer) : ByteBuffer = __vector_in_bytebuffer(_bb, 18, 8)
|
||
|
fun mutateTestdVec(j: Int, testdVec: Double) : Boolean {
|
||
|
val o = __offset(18)
|
||
|
return if (o != 0) {
|
||
|
bb.putDouble(__vector(o) + j * 8, testdVec)
|
||
|
true
|
||
|
} else {
|
||
|
false
|
||
|
}
|
||
|
}
|
||
|
companion object {
|
||
|
fun validateVersion() = Constants.FLATBUFFERS_1_11_1()
|
||
|
fun getRootAsMonsterExtra(_bb: ByteBuffer): MonsterExtra = getRootAsMonsterExtra(_bb, MonsterExtra())
|
||
|
fun getRootAsMonsterExtra(_bb: ByteBuffer, obj: MonsterExtra): MonsterExtra {
|
||
|
_bb.order(ByteOrder.LITTLE_ENDIAN)
|
||
|
return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
|
||
|
}
|
||
|
fun MonsterExtraBufferHasIdentifier(_bb: ByteBuffer) : Boolean = __has_identifier(_bb, "MONE")
|
||
|
fun createMonsterExtra(builder: FlatBufferBuilder, testfNan: Float, testfPinf: Float, testfNinf: Float, testdNan: Double, testdPinf: Double, testdNinf: Double, testfVecOffset: Int, testdVecOffset: Int) : Int {
|
||
|
builder.startTable(8)
|
||
|
addTestdNinf(builder, testdNinf)
|
||
|
addTestdPinf(builder, testdPinf)
|
||
|
addTestdNan(builder, testdNan)
|
||
|
addTestdVec(builder, testdVecOffset)
|
||
|
addTestfVec(builder, testfVecOffset)
|
||
|
addTestfNinf(builder, testfNinf)
|
||
|
addTestfPinf(builder, testfPinf)
|
||
|
addTestfNan(builder, testfNan)
|
||
|
return endMonsterExtra(builder)
|
||
|
}
|
||
|
fun startMonsterExtra(builder: FlatBufferBuilder) = builder.startTable(8)
|
||
|
fun addTestfNan(builder: FlatBufferBuilder, testfNan: Float) = builder.addFloat(0, testfNan, Double.NaN)
|
||
|
fun addTestfPinf(builder: FlatBufferBuilder, testfPinf: Float) = builder.addFloat(1, testfPinf, Double.POSITIVE_INFINITY)
|
||
|
fun addTestfNinf(builder: FlatBufferBuilder, testfNinf: Float) = builder.addFloat(2, testfNinf, Double.NEGATIVE_INFINITY)
|
||
|
fun addTestdNan(builder: FlatBufferBuilder, testdNan: Double) = builder.addDouble(3, testdNan, Double.NaN)
|
||
|
fun addTestdPinf(builder: FlatBufferBuilder, testdPinf: Double) = builder.addDouble(4, testdPinf, Double.POSITIVE_INFINITY)
|
||
|
fun addTestdNinf(builder: FlatBufferBuilder, testdNinf: Double) = builder.addDouble(5, testdNinf, Double.NEGATIVE_INFINITY)
|
||
|
fun addTestfVec(builder: FlatBufferBuilder, testfVec: Int) = builder.addOffset(6, testfVec, 0)
|
||
|
fun createTestfVecVector(builder: FlatBufferBuilder, data: FloatArray) : Int {
|
||
|
builder.startVector(4, data.size, 4)
|
||
|
for (i in data.size - 1 downTo 0) {
|
||
|
builder.addFloat(data[i])
|
||
|
}
|
||
|
return builder.endVector()
|
||
|
}
|
||
|
fun startTestfVecVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4)
|
||
|
fun addTestdVec(builder: FlatBufferBuilder, testdVec: Int) = builder.addOffset(7, testdVec, 0)
|
||
|
fun createTestdVecVector(builder: FlatBufferBuilder, data: DoubleArray) : Int {
|
||
|
builder.startVector(8, data.size, 8)
|
||
|
for (i in data.size - 1 downTo 0) {
|
||
|
builder.addDouble(data[i])
|
||
|
}
|
||
|
return builder.endVector()
|
||
|
}
|
||
|
fun startTestdVecVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(8, numElems, 8)
|
||
|
fun endMonsterExtra(builder: FlatBufferBuilder) : Int {
|
||
|
val o = builder.endTable()
|
||
|
return o
|
||
|
}
|
||
|
fun finishMonsterExtraBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finish(offset, "MONE")
|
||
|
fun finishSizePrefixedMonsterExtraBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finishSizePrefixed(offset, "MONE")
|
||
|
}
|
||
|
}
|