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// Code generated by protocol buffer compiler. Do not edit! 005package org.wpilib.math.proto; 006 007import java.io.IOException; 008import us.hebi.quickbuf.Descriptors; 009import us.hebi.quickbuf.FieldName; 010import us.hebi.quickbuf.InvalidProtocolBufferException; 011import us.hebi.quickbuf.JsonSink; 012import us.hebi.quickbuf.JsonSource; 013import us.hebi.quickbuf.MessageFactory; 014import us.hebi.quickbuf.ProtoMessage; 015import us.hebi.quickbuf.ProtoSink; 016import us.hebi.quickbuf.ProtoSource; 017 018/** 019 * Protobuf type {@code ProtobufPose3d} 020 */ 021@SuppressWarnings("hiding") 022public final class ProtobufPose3d extends ProtoMessage<ProtobufPose3d> implements Cloneable { 023 private static final long serialVersionUID = 0L; 024 025 /** 026 * <code>optional .wpi.proto.ProtobufTranslation3d translation = 1;</code> 027 */ 028 private final ProtobufTranslation3d translation = ProtobufTranslation3d.newInstance(); 029 030 /** 031 * <code>optional .wpi.proto.ProtobufRotation3d rotation = 2;</code> 032 */ 033 private final ProtobufRotation3d rotation = ProtobufRotation3d.newInstance(); 034 035 private ProtobufPose3d() { 036 } 037 038 /** 039 * @return a new empty instance of {@code ProtobufPose3d} 040 */ 041 public static ProtobufPose3d newInstance() { 042 return new ProtobufPose3d(); 043 } 044 045 /** 046 * <code>optional .wpi.proto.ProtobufTranslation3d translation = 1;</code> 047 * @return whether the translation field is set 048 */ 049 public boolean hasTranslation() { 050 return (bitField0_ & 0x00000001) != 0; 051 } 052 053 /** 054 * <code>optional .wpi.proto.ProtobufTranslation3d translation = 1;</code> 055 * @return this 056 */ 057 public ProtobufPose3d clearTranslation() { 058 bitField0_ &= ~0x00000001; 059 translation.clear(); 060 return this; 061 } 062 063 /** 064 * <code>optional .wpi.proto.ProtobufTranslation3d translation = 1;</code> 065 * 066 * This method returns the internal storage object without modifying any has state. 067 * The returned object should not be modified and be treated as read-only. 068 * 069 * Use {@link #getMutableTranslation()} if you want to modify it. 070 * 071 * @return internal storage object for reading 072 */ 073 public ProtobufTranslation3d getTranslation() { 074 return translation; 075 } 076 077 /** 078 * <code>optional .wpi.proto.ProtobufTranslation3d translation = 1;</code> 079 * 080 * This method returns the internal storage object and sets the corresponding 081 * has state. The returned object will become part of this message and its 082 * contents may be modified as long as the has state is not cleared. 083 * 084 * @return internal storage object for modifications 085 */ 086 public ProtobufTranslation3d getMutableTranslation() { 087 bitField0_ |= 0x00000001; 088 return translation; 089 } 090 091 /** 092 * <code>optional .wpi.proto.ProtobufTranslation3d translation = 1;</code> 093 * @param value the translation to set 094 * @return this 095 */ 096 public ProtobufPose3d setTranslation(final ProtobufTranslation3d value) { 097 bitField0_ |= 0x00000001; 098 translation.copyFrom(value); 099 return this; 100 } 101 102 /** 103 * <code>optional .wpi.proto.ProtobufRotation3d rotation = 2;</code> 104 * @return whether the rotation field is set 105 */ 106 public boolean hasRotation() { 107 return (bitField0_ & 0x00000002) != 0; 108 } 109 110 /** 111 * <code>optional .wpi.proto.ProtobufRotation3d rotation = 2;</code> 112 * @return this 113 */ 114 public ProtobufPose3d clearRotation() { 115 bitField0_ &= ~0x00000002; 116 rotation.clear(); 117 return this; 118 } 119 120 /** 121 * <code>optional .wpi.proto.ProtobufRotation3d rotation = 2;</code> 122 * 123 * This method returns the internal storage object without modifying any has state. 124 * The returned object should not be modified and be treated as read-only. 125 * 126 * Use {@link #getMutableRotation()} if you want to modify it. 127 * 128 * @return internal storage object for reading 129 */ 130 public ProtobufRotation3d getRotation() { 131 return rotation; 132 } 133 134 /** 135 * <code>optional .wpi.proto.ProtobufRotation3d rotation = 2;</code> 136 * 137 * This method returns the internal storage object and sets the corresponding 138 * has state. The returned object will become part of this message and its 139 * contents may be modified as long as the has state is not cleared. 140 * 141 * @return internal storage object for modifications 142 */ 143 public ProtobufRotation3d getMutableRotation() { 144 bitField0_ |= 0x00000002; 145 return rotation; 146 } 147 148 /** 149 * <code>optional .wpi.proto.ProtobufRotation3d rotation = 2;</code> 150 * @param value the rotation to set 151 * @return this 152 */ 153 public ProtobufPose3d setRotation(final ProtobufRotation3d value) { 154 bitField0_ |= 0x00000002; 155 rotation.copyFrom(value); 156 return this; 157 } 158 159 @Override 160 public ProtobufPose3d copyFrom(final ProtobufPose3d other) { 161 cachedSize = other.cachedSize; 162 if ((bitField0_ | other.bitField0_) != 0) { 163 bitField0_ = other.bitField0_; 164 translation.copyFrom(other.translation); 165 rotation.copyFrom(other.rotation); 166 } 167 return this; 168 } 169 170 @Override 171 public ProtobufPose3d mergeFrom(final ProtobufPose3d other) { 172 if (other.isEmpty()) { 173 return this; 174 } 175 cachedSize = -1; 176 if (other.hasTranslation()) { 177 getMutableTranslation().mergeFrom(other.translation); 178 } 179 if (other.hasRotation()) { 180 getMutableRotation().mergeFrom(other.rotation); 181 } 182 return this; 183 } 184 185 @Override 186 public ProtobufPose3d clear() { 187 if (isEmpty()) { 188 return this; 189 } 190 cachedSize = -1; 191 bitField0_ = 0; 192 translation.clear(); 193 rotation.clear(); 194 return this; 195 } 196 197 @Override 198 public ProtobufPose3d clearQuick() { 199 if (isEmpty()) { 200 return this; 201 } 202 cachedSize = -1; 203 bitField0_ = 0; 204 translation.clearQuick(); 205 rotation.clearQuick(); 206 return this; 207 } 208 209 @Override 210 public boolean equals(Object o) { 211 if (o == this) { 212 return true; 213 } 214 if (!(o instanceof ProtobufPose3d)) { 215 return false; 216 } 217 ProtobufPose3d other = (ProtobufPose3d) o; 218 return bitField0_ == other.bitField0_ 219 && (!hasTranslation() || translation.equals(other.translation)) 220 && (!hasRotation() || rotation.equals(other.rotation)); 221 } 222 223 @Override 224 public void writeTo(final ProtoSink output) throws IOException { 225 if ((bitField0_ & 0x00000001) != 0) { 226 output.writeRawByte((byte) 10); 227 output.writeMessageNoTag(translation); 228 } 229 if ((bitField0_ & 0x00000002) != 0) { 230 output.writeRawByte((byte) 18); 231 output.writeMessageNoTag(rotation); 232 } 233 } 234 235 @Override 236 protected int computeSerializedSize() { 237 int size = 0; 238 if ((bitField0_ & 0x00000001) != 0) { 239 size += 1 + ProtoSink.computeMessageSizeNoTag(translation); 240 } 241 if ((bitField0_ & 0x00000002) != 0) { 242 size += 1 + ProtoSink.computeMessageSizeNoTag(rotation); 243 } 244 return size; 245 } 246 247 @Override 248 @SuppressWarnings("fallthrough") 249 public ProtobufPose3d mergeFrom(final ProtoSource input) throws IOException { 250 // Enabled Fall-Through Optimization (QuickBuffers) 251 int tag = input.readTag(); 252 while (true) { 253 switch (tag) { 254 case 10: { 255 // translation 256 input.readMessage(translation); 257 bitField0_ |= 0x00000001; 258 tag = input.readTag(); 259 if (tag != 18) { 260 break; 261 } 262 } 263 case 18: { 264 // rotation 265 input.readMessage(rotation); 266 bitField0_ |= 0x00000002; 267 tag = input.readTag(); 268 if (tag != 0) { 269 break; 270 } 271 } 272 case 0: { 273 return this; 274 } 275 default: { 276 if (!input.skipField(tag)) { 277 return this; 278 } 279 tag = input.readTag(); 280 break; 281 } 282 } 283 } 284 } 285 286 @Override 287 public void writeTo(final JsonSink output) throws IOException { 288 output.beginObject(); 289 if ((bitField0_ & 0x00000001) != 0) { 290 output.writeMessage(FieldNames.translation, translation); 291 } 292 if ((bitField0_ & 0x00000002) != 0) { 293 output.writeMessage(FieldNames.rotation, rotation); 294 } 295 output.endObject(); 296 } 297 298 @Override 299 public ProtobufPose3d mergeFrom(final JsonSource input) throws IOException { 300 if (!input.beginObject()) { 301 return this; 302 } 303 while (!input.isAtEnd()) { 304 switch (input.readFieldHash()) { 305 case -1840647503: { 306 if (input.isAtField(FieldNames.translation)) { 307 if (!input.trySkipNullValue()) { 308 input.readMessage(translation); 309 bitField0_ |= 0x00000001; 310 } 311 } else { 312 input.skipUnknownField(); 313 } 314 break; 315 } 316 case -40300674: { 317 if (input.isAtField(FieldNames.rotation)) { 318 if (!input.trySkipNullValue()) { 319 input.readMessage(rotation); 320 bitField0_ |= 0x00000002; 321 } 322 } else { 323 input.skipUnknownField(); 324 } 325 break; 326 } 327 default: { 328 input.skipUnknownField(); 329 break; 330 } 331 } 332 } 333 input.endObject(); 334 return this; 335 } 336 337 @Override 338 public ProtobufPose3d clone() { 339 return new ProtobufPose3d().copyFrom(this); 340 } 341 342 @Override 343 public boolean isEmpty() { 344 return ((bitField0_) == 0); 345 } 346 347 public static ProtobufPose3d parseFrom(final byte[] data) throws InvalidProtocolBufferException { 348 return ProtoMessage.mergeFrom(new ProtobufPose3d(), data).checkInitialized(); 349 } 350 351 public static ProtobufPose3d parseFrom(final ProtoSource input) throws IOException { 352 return ProtoMessage.mergeFrom(new ProtobufPose3d(), input).checkInitialized(); 353 } 354 355 public static ProtobufPose3d parseFrom(final JsonSource input) throws IOException { 356 return ProtoMessage.mergeFrom(new ProtobufPose3d(), input).checkInitialized(); 357 } 358 359 /** 360 * @return factory for creating ProtobufPose3d messages 361 */ 362 public static MessageFactory<ProtobufPose3d> getFactory() { 363 return ProtobufPose3dFactory.INSTANCE; 364 } 365 366 /** 367 * @return this type's descriptor. 368 */ 369 public static Descriptors.Descriptor getDescriptor() { 370 return ProtobufGeometry3dDescriptor.wpi_proto_ProtobufPose3d_descriptor; 371 } 372 373 private enum ProtobufPose3dFactory implements MessageFactory<ProtobufPose3d> { 374 INSTANCE; 375 376 @Override 377 public ProtobufPose3d create() { 378 return ProtobufPose3d.newInstance(); 379 } 380 } 381 382 /** 383 * Contains name constants used for serializing JSON 384 */ 385 static class FieldNames { 386 static final FieldName translation = FieldName.forField("translation"); 387 388 static final FieldName rotation = FieldName.forField("rotation"); 389 } 390}