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

import * as flatbuffers from 'flatbuffers';

import { Quaternion } from '../foxglove/quaternion.ts';
import { Vector3 } from '../foxglove/vector3.ts';


/**
 * A position and orientation for an object or reference frame in 3D space
 */
export class Pose {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):Pose {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

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

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

/**
 * Point denoting position in 3D space
 */
position(obj?:Vector3):Vector3|null {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? (obj || new Vector3()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}

/**
 * Quaternion denoting orientation in 3D space
 */
orientation(obj?:Quaternion):Quaternion|null {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? (obj || new Quaternion()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}

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

static addPosition(builder:flatbuffers.Builder, positionOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, positionOffset, 0);
}

static addOrientation(builder:flatbuffers.Builder, orientationOffset:flatbuffers.Offset) {
  builder.addFieldOffset(1, orientationOffset, 0);
}

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

static finishPoseBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
  builder.finish(offset);
}

static finishSizePrefixedPoseBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
  builder.finish(offset, undefined, true);
}

}
