001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.math.geometry.proto;
006
007import edu.wpi.first.math.geometry.Translation3d;
008import edu.wpi.first.math.proto.Geometry3D.ProtobufTranslation3d;
009import edu.wpi.first.util.protobuf.Protobuf;
010import us.hebi.quickbuf.Descriptors.Descriptor;
011
012public class Translation3dProto implements Protobuf<Translation3d, ProtobufTranslation3d> {
013  @Override
014  public Class<Translation3d> getTypeClass() {
015    return Translation3d.class;
016  }
017
018  @Override
019  public Descriptor getDescriptor() {
020    return ProtobufTranslation3d.getDescriptor();
021  }
022
023  @Override
024  public ProtobufTranslation3d createMessage() {
025    return ProtobufTranslation3d.newInstance();
026  }
027
028  @Override
029  public Translation3d unpack(ProtobufTranslation3d msg) {
030    return new Translation3d(msg.getX(), msg.getY(), msg.getZ());
031  }
032
033  @Override
034  public void pack(ProtobufTranslation3d msg, Translation3d value) {
035    msg.setX(value.getX());
036    msg.setY(value.getY());
037    msg.setZ(value.getZ());
038  }
039}