...

Text file src/github.com/google/flatbuffers/tests/DictionaryLookup/LongFloatMap.kt

Documentation: github.com/google/flatbuffers/tests/DictionaryLookup

     1// automatically generated by the FlatBuffers compiler, do not modify
     2
     3package DictionaryLookup
     4
     5import com.google.flatbuffers.BaseVector
     6import com.google.flatbuffers.BooleanVector
     7import com.google.flatbuffers.ByteVector
     8import com.google.flatbuffers.Constants
     9import com.google.flatbuffers.DoubleVector
    10import com.google.flatbuffers.FlatBufferBuilder
    11import com.google.flatbuffers.FloatVector
    12import com.google.flatbuffers.LongVector
    13import com.google.flatbuffers.StringVector
    14import com.google.flatbuffers.Struct
    15import com.google.flatbuffers.Table
    16import com.google.flatbuffers.UnionVector
    17import java.nio.ByteBuffer
    18import java.nio.ByteOrder
    19import kotlin.math.sign
    20
    21@Suppress("unused")
    22class LongFloatMap : Table() {
    23
    24    fun __init(_i: Int, _bb: ByteBuffer)  {
    25        __reset(_i, _bb)
    26    }
    27    fun __assign(_i: Int, _bb: ByteBuffer) : LongFloatMap {
    28        __init(_i, _bb)
    29        return this
    30    }
    31    fun entries(j: Int) : DictionaryLookup.LongFloatEntry? = entries(DictionaryLookup.LongFloatEntry(), j)
    32    fun entries(obj: DictionaryLookup.LongFloatEntry, j: Int) : DictionaryLookup.LongFloatEntry? {
    33        val o = __offset(4)
    34        return if (o != 0) {
    35            obj.__assign(__indirect(__vector(o) + j * 4), bb)
    36        } else {
    37            null
    38        }
    39    }
    40    val entriesLength : Int
    41        get() {
    42            val o = __offset(4); return if (o != 0) __vector_len(o) else 0
    43        }
    44    fun entriesByKey(key: Long) : DictionaryLookup.LongFloatEntry? {
    45        val o = __offset(4)
    46        return if (o != 0) {
    47            DictionaryLookup.LongFloatEntry.__lookup_by_key(null, __vector(o), key, bb)
    48        } else {
    49            null
    50        }
    51    }
    52    fun entriesByKey(obj: DictionaryLookup.LongFloatEntry, key: Long) : DictionaryLookup.LongFloatEntry? {
    53        val o = __offset(4)
    54        return if (o != 0) {
    55            DictionaryLookup.LongFloatEntry.__lookup_by_key(obj, __vector(o), key, bb)
    56        } else {
    57            null
    58        }
    59    }
    60    companion object {
    61        fun validateVersion() = Constants.FLATBUFFERS_23_5_26()
    62        fun getRootAsLongFloatMap(_bb: ByteBuffer): LongFloatMap = getRootAsLongFloatMap(_bb, LongFloatMap())
    63        fun getRootAsLongFloatMap(_bb: ByteBuffer, obj: LongFloatMap): LongFloatMap {
    64            _bb.order(ByteOrder.LITTLE_ENDIAN)
    65            return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
    66        }
    67        fun createLongFloatMap(builder: FlatBufferBuilder, entriesOffset: Int) : Int {
    68            builder.startTable(1)
    69            addEntries(builder, entriesOffset)
    70            return endLongFloatMap(builder)
    71        }
    72        fun startLongFloatMap(builder: FlatBufferBuilder) = builder.startTable(1)
    73        fun addEntries(builder: FlatBufferBuilder, entries: Int) = builder.addOffset(0, entries, 0)
    74        fun createEntriesVector(builder: FlatBufferBuilder, data: IntArray) : Int {
    75            builder.startVector(4, data.size, 4)
    76            for (i in data.size - 1 downTo 0) {
    77                builder.addOffset(data[i])
    78            }
    79            return builder.endVector()
    80        }
    81        fun startEntriesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4)
    82        fun endLongFloatMap(builder: FlatBufferBuilder) : Int {
    83            val o = builder.endTable()
    84            return o
    85        }
    86        fun finishLongFloatMapBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finish(offset)
    87        fun finishSizePrefixedLongFloatMapBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finishSizePrefixed(offset)
    88    }
    89}

View as plain text