// automatically generated by the FlatBuffers compiler, do not modify
import flatbuffers

namespace flatbuffers.goldens

class Galaxy

class Universe

class Galaxy : flatbuffers.handle
    def num_stars() -> int:
        return flatbuffers.field_int64(buf_, pos_, 4, 0)

def GetRootAsGalaxy(buf:string): return Galaxy { buf, flatbuffers.indirect(buf, 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 flatbuffers.field_float64(buf_, pos_, 4, 0.0)
    def galaxies(i:int) -> flatbuffers.goldens.Galaxy:
        return flatbuffers.goldens.Galaxy { buf_, flatbuffers.indirect(buf_, flatbuffers.field_vector(buf_, pos_, 6) + i * 4) }
    def galaxies_length() -> int:
        return flatbuffers.field_vector_len(buf_, pos_, 6)

def GetRootAsUniverse(buf:string): return Universe { buf, flatbuffers.indirect(buf, 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)

