56 lines
1.7 KiB
Plaintext
56 lines
1.7 KiB
Plaintext
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||
|
import flatbuffers
|
||
|
|
||
|
class Galaxy
|
||
|
|
||
|
class Universe
|
||
|
|
||
|
class Galaxy : flatbuffers_handle
|
||
|
def num_stars() -> int:
|
||
|
return buf_.flatbuffers_field_int64(pos_, 4, 0)
|
||
|
|
||
|
def GetRootAsGalaxy(buf:string): return Galaxy { buf, buf.flatbuffers_indirect(0) }
|
||
|
|
||
|
struct GalaxyBuilder:
|
||
|
b_:flatbuffers_builder
|
||
|
def start():
|
||
|
b_.StartObject(1)
|
||
|
return this
|
||
|
def add_num_stars(num_stars:int):
|
||
|
b_.PrependInt64Slot(0, num_stars, 0)
|
||
|
return this
|
||
|
def end():
|
||
|
return b_.EndObject()
|
||
|
|
||
|
class Universe : flatbuffers_handle
|
||
|
def age() -> float:
|
||
|
return buf_.flatbuffers_field_float64(pos_, 4, 0.0)
|
||
|
def galaxies(i:int) -> Galaxy:
|
||
|
return Galaxy { buf_, buf_.flatbuffers_indirect(buf_.flatbuffers_field_vector(pos_, 6) + i * 4) }
|
||
|
def galaxies_length() -> int:
|
||
|
return buf_.flatbuffers_field_vector_len(pos_, 6)
|
||
|
|
||
|
def GetRootAsUniverse(buf:string): return Universe { buf, buf.flatbuffers_indirect(0) }
|
||
|
|
||
|
struct UniverseBuilder:
|
||
|
b_:flatbuffers_builder
|
||
|
def start():
|
||
|
b_.StartObject(2)
|
||
|
return this
|
||
|
def add_age(age:float):
|
||
|
b_.PrependFloat64Slot(0, age, 0.0)
|
||
|
return this
|
||
|
def add_galaxies(galaxies:flatbuffers_offset):
|
||
|
b_.PrependUOffsetTRelativeSlot(1, galaxies)
|
||
|
return this
|
||
|
def end():
|
||
|
return b_.EndObject()
|
||
|
|
||
|
def UniverseStartGalaxiesVector(b_:flatbuffers_builder, n_:int):
|
||
|
b_.StartVector(4, n_, 4)
|
||
|
def UniverseCreateGalaxiesVector(b_:flatbuffers_builder, v_:[flatbuffers_offset]):
|
||
|
b_.StartVector(4, v_.length, 4)
|
||
|
reverse(v_) e_: b_.PrependUOffsetTRelative(e_)
|
||
|
return b_.EndVector(v_.length)
|
||
|
|