// 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 WriteRegisterResponse implements flatbuffers.IUnpackableObject<WriteRegisterResponseT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):WriteRegisterResponse {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

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

static getSizePrefixedRootAsWriteRegisterResponse(bb:flatbuffers.ByteBuffer, obj?:WriteRegisterResponse):WriteRegisterResponse {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new WriteRegisterResponse()).__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;
}

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

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

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

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

success():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 8);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

mutate_success(value:boolean):boolean {
  const offset = this.bb!.__offset(this.bb_pos, 8);

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

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

static startWriteRegisterResponse(builder:flatbuffers.Builder) {
  builder.startObject(3);
}

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

static addSize(builder:flatbuffers.Builder, size:number) {
  builder.addFieldInt32(1, size, 0);
}

static addSuccess(builder:flatbuffers.Builder, success:boolean) {
  builder.addFieldInt8(2, +success, +false);
}

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

static createWriteRegisterResponse(builder:flatbuffers.Builder, register:number, size:number, success:boolean):flatbuffers.Offset {
  WriteRegisterResponse.startWriteRegisterResponse(builder);
  WriteRegisterResponse.addRegister(builder, register);
  WriteRegisterResponse.addSize(builder, size);
  WriteRegisterResponse.addSuccess(builder, success);
  return WriteRegisterResponse.endWriteRegisterResponse(builder);
}

unpack(): WriteRegisterResponseT {
  return new WriteRegisterResponseT(
    this.register(),
    this.size(),
    this.success()
  );
}


unpackTo(_o: WriteRegisterResponseT): void {
  _o.register = this.register();
  _o.size = this.size();
  _o.success = this.success();
}
}

export class WriteRegisterResponseT implements flatbuffers.IGeneratedObject {
constructor(
  public register: number = 0,
  public size: number = 0,
  public success: boolean = false
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  return WriteRegisterResponse.createWriteRegisterResponse(builder,
    this.register,
    this.size,
    this.success
  );
}
}
