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

/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */

import * as flatbuffers from 'flatbuffers';



export class ReadRegisterRequest implements flatbuffers.IUnpackableObject<ReadRegisterRequestT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):ReadRegisterRequest {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

static getRootAsReadRegisterRequest(bb:flatbuffers.ByteBuffer, obj?:ReadRegisterRequest):ReadRegisterRequest {
  return (obj || new ReadRegisterRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

static getSizePrefixedRootAsReadRegisterRequest(bb:flatbuffers.ByteBuffer, obj?:ReadRegisterRequest):ReadRegisterRequest {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new ReadRegisterRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

register():number {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
}

mutate_register(value:number):boolean {
  const offset = this.bb!.__offset(this.bb_pos, 4);

  if (offset === 0) {
    return false;
  }

  this.bb!.writeUint32(this.bb_pos + offset, value);
  return true;
}

static startReadRegisterRequest(builder:flatbuffers.Builder) {
  builder.startObject(1);
}

static addRegister(builder:flatbuffers.Builder, register:number) {
  builder.addFieldInt32(0, register, 0);
}

static endReadRegisterRequest(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  return offset;
}

static createReadRegisterRequest(builder:flatbuffers.Builder, register:number):flatbuffers.Offset {
  ReadRegisterRequest.startReadRegisterRequest(builder);
  ReadRegisterRequest.addRegister(builder, register);
  return ReadRegisterRequest.endReadRegisterRequest(builder);
}

unpack(): ReadRegisterRequestT {
  return new ReadRegisterRequestT(
    this.register()
  );
}


unpackTo(_o: ReadRegisterRequestT): void {
  _o.register = this.register();
}
}

export class ReadRegisterRequestT implements flatbuffers.IGeneratedObject {
constructor(
  public register: number = 0
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  return ReadRegisterRequest.createReadRegisterRequest(builder,
    this.register
  );
}
}
