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

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

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

address():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
}

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

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

  this.bb!.writeUint64(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;
}

static startReadMemoryRequest(builder:flatbuffers.Builder) {
  builder.startObject(2);
}

static addAddress(builder:flatbuffers.Builder, address:bigint) {
  builder.addFieldInt64(0, address, BigInt('0'));
}

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

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

static createReadMemoryRequest(builder:flatbuffers.Builder, address:bigint, size:number):flatbuffers.Offset {
  ReadMemoryRequest.startReadMemoryRequest(builder);
  ReadMemoryRequest.addAddress(builder, address);
  ReadMemoryRequest.addSize(builder, size);
  return ReadMemoryRequest.endReadMemoryRequest(builder);
}

unpack(): ReadMemoryRequestT {
  return new ReadMemoryRequestT(
    this.address(),
    this.size()
  );
}


unpackTo(_o: ReadMemoryRequestT): void {
  _o.address = this.address();
  _o.size = this.size();
}
}

export class ReadMemoryRequestT implements flatbuffers.IGeneratedObject {
constructor(
  public address: bigint = BigInt('0'),
  public size: number = 0
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  return ReadMemoryRequest.createReadMemoryRequest(builder,
    this.address,
    this.size
  );
}
}
