From b5912f65846a4d3d6b592ddbb5f742205da77b71 Mon Sep 17 00:00:00 2001 From: Jacob Bandes-Storch Date: Fri, 27 Oct 2023 16:14:14 -0500 Subject: [PATCH 1/7] Run lint & build in CI --- .github/workflows/ci.yml | 38 ++++ .swiftformat | 3 + .swiftlint.yml | 15 ++ Makefile | 22 +++ WebSocketDemo-Shared/CameraManager.swift | 158 +++++++++-------- WebSocketDemo-Shared/CardToggle.swift | 4 +- WebSocketDemo-Shared/ContentView.swift | 49 +++--- WebSocketDemo-Shared/FoxgloveServer.swift | 118 +++++++------ WebSocketDemo-Shared/IPAddressRow.swift | 18 +- .../Onboarding/ConnectionView.swift | 7 +- .../Onboarding/ContinueButton.swift | 2 +- .../Onboarding/IntroView.swift | 8 +- .../Onboarding/OnboardingView.swift | 2 +- .../Onboarding/StudioUsageView.swift | 12 +- .../Schemas/foxglove/ArrowPrimitive.pb.swift | 89 +++++----- .../foxglove/CameraCalibration.pb.swift | 156 +++++++++-------- .../foxglove/CircleAnnotation.pb.swift | 100 ++++++----- .../Schemas/foxglove/Color.pb.swift | 52 +++--- .../Schemas/foxglove/CompressedImage.pb.swift | 74 ++++---- .../Schemas/foxglove/CompressedVideo.pb.swift | 78 +++++---- .../Schemas/foxglove/CubePrimitive.pb.swift | 69 ++++---- .../foxglove/CylinderPrimitive.pb.swift | 88 +++++----- .../Schemas/foxglove/FrameTransform.pb.swift | 89 +++++----- .../Schemas/foxglove/FrameTransforms.pb.swift | 28 +-- .../Schemas/foxglove/GeoJSON.pb.swift | 30 ++-- .../Schemas/foxglove/Grid.pb.swift | 129 +++++++------- .../foxglove/ImageAnnotations.pb.swift | 44 ++--- .../Schemas/foxglove/KeyValuePair.pb.swift | 40 +++-- .../Schemas/foxglove/LaserScan.pb.swift | 99 ++++++----- .../Schemas/foxglove/LinePrimitive.pb.swift | 147 ++++++++-------- .../Schemas/foxglove/LocationFix.pb.swift | 121 ++++++------- .../Schemas/foxglove/Log.pb.swift | 126 +++++++------- .../Schemas/foxglove/ModelPrimitive.pb.swift | 119 +++++++------ .../foxglove/PackedElementField.pb.swift | 99 +++++------ .../Schemas/foxglove/Point2.pb.swift | 36 ++-- .../Schemas/foxglove/Point3.pb.swift | 44 ++--- .../Schemas/foxglove/PointCloud.pb.swift | 96 ++++++----- .../foxglove/PointsAnnotation.pb.swift | 138 ++++++++------- .../Schemas/foxglove/Pose.pb.swift | 54 +++--- .../Schemas/foxglove/PoseInFrame.pb.swift | 64 +++---- .../Schemas/foxglove/PosesInFrame.pb.swift | 57 +++--- .../Schemas/foxglove/Quaternion.pb.swift | 52 +++--- .../Schemas/foxglove/RawImage.pb.swift | 101 +++++------ .../Schemas/foxglove/SceneEntity.pb.swift | 163 +++++++++--------- .../foxglove/SceneEntityDeletion.pb.swift | 82 ++++----- .../Schemas/foxglove/SceneUpdate.pb.swift | 36 ++-- .../Schemas/foxglove/SpherePrimitive.pb.swift | 69 ++++---- .../Schemas/foxglove/TextAnnotation.pb.swift | 102 +++++------ .../Schemas/foxglove/TextPrimitive.pb.swift | 94 +++++----- .../foxglove/TriangleListPrimitive.pb.swift | 86 ++++----- .../Schemas/foxglove/Vector2.pb.swift | 36 ++-- .../Schemas/foxglove/Vector3.pb.swift | 44 ++--- WebSocketDemo-Shared/Server.swift | 137 ++++++++------- WebSocketDemo-Shared/compareIPAddresses.swift | 12 +- WebSocketDemo-Shared/getCPUUsage.swift | 19 +- WebSocketDemo-Shared/getMemoryUsage.swift | 3 +- WebSocketDemo-Shared/schemas.swift | 3 + WebSocketDemo-Watch/ContentView.swift | 21 ++- 58 files changed, 2052 insertions(+), 1730 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .swiftformat create mode 100644 .swiftlint.yml create mode 100644 Makefile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d97a636 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: ["*"] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + + - run: make lint-ci + - run: make format-ci + + build: + needs: + - lint + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + + - uses: actions/cache@v3 + with: + path: | + .swiftpm-packages + key: v0-${{ runner.os }}-swiftpm-${{ hashFiles('**/Package.resolved') }} + restore-keys: v0-${{ runner.os }}-swiftpm- + + - run: make build diff --git a/.swiftformat b/.swiftformat new file mode 100644 index 0000000..1e21ac0 --- /dev/null +++ b/.swiftformat @@ -0,0 +1,3 @@ +--swiftversion 5.9 +--indent 2 +--maxwidth 120 diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..81f458a --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,15 @@ +excluded: + - .build + - .swiftpm-packages + - WebSocketDemo-Shared/Schemas/foxglove + +disabled_rules: + - function_body_length + - type_body_length + - file_length + - cyclomatic_complexity + - identifier_name + - opening_brace # conflicts with swiftformat + +trailing_comma: + mandatory_comma: true diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e5a027b --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +.PHONY: build +build: + # https://developer.apple.com/documentation/xcode/building-swift-packages-or-apps-that-use-them-in-continuous-integration-workflows + # https://stackoverflow.com/questions/4969932/separate-build-directory-using-xcodebuild + # https://forums.swift.org/t/swiftpm-with-git-lfs/42396/4 + GIT_LFS_SKIP_DOWNLOAD_ERRORS=1 \ + xcodebuild \ + -disableAutomaticPackageResolution \ + -clonedSourcePackagesDirPath .swiftpm-packages \ + -destination generic/platform=iOS \ + -scheme "Foxglove Bridge" \ + SYMROOT="$(PWD)"/build \ + -configuration Release \ + clean build analyze + +.PHONY: lint-ci +lint-ci: + docker run -t --platform linux/amd64 --rm -v "$(PWD)":/work -w /work ghcr.io/realm/swiftlint:0.53.0 + +.PHONY: format-ci +format-ci: + docker run -t --rm -v "$(PWD)":/work ghcr.io/nicklockwood/swiftformat:0.52.8 --lint /work diff --git a/WebSocketDemo-Shared/CameraManager.swift b/WebSocketDemo-Shared/CameraManager.swift index a39f345..46d1a3d 100644 --- a/WebSocketDemo-Shared/CameraManager.swift +++ b/WebSocketDemo-Shared/CameraManager.swift @@ -1,8 +1,8 @@ import AVFoundation -import VideoToolbox import Combine import CoreImage import UIKit +import VideoToolbox enum Camera: CaseIterable, Identifiable, CustomStringConvertible { case back @@ -11,14 +11,14 @@ enum Camera: CaseIterable, Identifiable, CustomStringConvertible { var description: String { switch self { case .back: - return "Back" + "Back" case .front: - return "Front" + "Front" } } var id: Self { - return self + self } } @@ -36,13 +36,12 @@ private func configureInputs(in session: AVCaptureSession, for camera: Camera) t for input in session.inputs { session.removeInput(input) } - - let device: AVCaptureDevice? - switch camera { + + let device: AVCaptureDevice? = switch camera { case .back: - device = .default(.builtInWideAngleCamera, for: .video, position: .back) + .default(.builtInWideAngleCamera, for: .video, position: .back) case .front: - device = .default(.builtInWideAngleCamera, for: .video, position: .front) + .default(.builtInWideAngleCamera, for: .video, position: .front) } guard let device else { @@ -53,7 +52,7 @@ private func configureInputs(in session: AVCaptureSession, for camera: Camera) t let input = try AVCaptureDeviceInput(device: device) print("ranges: \(input.device.activeFormat.videoSupportedFrameRateRanges)") session.addInput(input) - } catch let error { + } catch { print("failed to create device input: \(error)") } } @@ -70,26 +69,26 @@ class CameraManager: NSObject, ObservableObject { private var compressionSession: VTCompressionSession? private var videoOutput: AVCaptureVideoDataOutput? private var forceKeyFrame = true - + let h264Frames = PassthroughSubject() let jpegFrames = PassthroughSubject() let calibrationData = PassthroughSubject() - + @Published var currentError: Error? - + @Published var droppedFrames = 0 - + @Published var activeCamera: Camera = .back { didSet { print("set active camera \(activeCamera)") reconfigureSession() } } - + private var _useVideoCompressionFlag: Int32 = 0 public var useVideoCompression: Bool { get { - return OSAtomicAdd32(0, &_useVideoCompressionFlag) != 0 + OSAtomicAdd32(0, &_useVideoCompressionFlag) != 0 } set { if newValue { @@ -97,36 +96,35 @@ class CameraManager: NSObject, ObservableObject { } else { OSAtomicTestAndClear(0, &_useVideoCompressionFlag) } - + reconfigureSession() } } - + override init() { super.init() useVideoCompression = true } - + @MainActor func startCameraUpdates() { Task { @MainActor in droppedFrames = 0 } - let activeCamera = self.activeCamera - + let activeCamera = activeCamera + queue.async { [self] in let captureSession = AVCaptureSession() - + do { try configureInputs(in: captureSession, for: activeCamera) - } catch let error { + } catch { print("error starting session: \(error)") } captureSession.sessionPreset = useVideoCompression ? .high : .medium - - + let output = AVCaptureVideoDataOutput() - output.setSampleBufferDelegate(self, queue: self.queue) + output.setSampleBufferDelegate(self, queue: queue) captureSession.addOutput(output) if let connection = output.connection(with: .video) { print("intrinsic supported: \(connection.isCameraIntrinsicMatrixDeliverySupported)") @@ -134,8 +132,8 @@ class CameraManager: NSObject, ObservableObject { connection.isCameraIntrinsicMatrixDeliveryEnabled = true } } - self.videoOutput = output - + videoOutput = output + do { try createCompressionSession(for: output) } catch let err { @@ -147,40 +145,40 @@ class CameraManager: NSObject, ObservableObject { Task { @MainActor in currentError = nil } - + captureSession.startRunning() self.captureSession = captureSession } } - + @MainActor func stopCameraUpdates() { queue.async(qos: .userInitiated) { [self] in captureSession?.stopRunning() } } - + private func createCompressionSession(for output: AVCaptureVideoDataOutput) throws { if let compressionSession { VTCompressionSessionInvalidate(compressionSession) self.compressionSession = nil } - + guard let width = output.videoSettings[kCVPixelBufferWidthKey as String] as? Int32, let height = output.videoSettings[kCVPixelBufferHeightKey as String] as? Int32 else { throw CameraError.unknownSize } - + var err: OSStatus - + err = VTCompressionSessionCreate( allocator: kCFAllocatorDefault, width: width, height: height, codecType: kCMVideoCodecType_H264, encoderSpecification: [ - kVTVideoEncoderSpecification_EnableLowLatencyRateControl: kCFBooleanTrue + kVTVideoEncoderSpecification_EnableLowLatencyRateControl: kCFBooleanTrue, ] as CFDictionary, imageBufferAttributes: nil, compressedDataAllocator: nil, @@ -188,17 +186,21 @@ class CameraManager: NSObject, ObservableObject { refcon: nil, compressionSessionOut: &compressionSession ) - guard err == noErr, let compressionSession = compressionSession else { + guard err == noErr, let compressionSession else { print("VTCompressionSessionCreate failed (\(err))") throw NSError(domain: NSOSStatusErrorDomain, code: Int(err)) } - - err = VTSessionSetProperty(compressionSession, key: kVTCompressionPropertyKey_ProfileLevel, value: kVTProfileLevel_H264_Main_AutoLevel) + + err = VTSessionSetProperty( + compressionSession, + key: kVTCompressionPropertyKey_ProfileLevel, + value: kVTProfileLevel_H264_Main_AutoLevel + ) guard err == noErr else { print("VTSessionSetProperty(kVTCompressionPropertyKey_ProfileLevel) failed (\(err))") throw NSError(domain: NSOSStatusErrorDomain, code: Int(err)) } - + // Indicate that the compression session is in real time, which streaming // requires. err = VTSessionSetProperty(compressionSession, key: kVTCompressionPropertyKey_RealTime, value: kCFBooleanTrue) @@ -207,30 +209,42 @@ class CameraManager: NSObject, ObservableObject { throw NSError(domain: NSOSStatusErrorDomain, code: Int(err)) } // Enables temporal compression. - err = VTSessionSetProperty(compressionSession, key: kVTCompressionPropertyKey_AllowTemporalCompression, value: kCFBooleanTrue) + err = VTSessionSetProperty( + compressionSession, + key: kVTCompressionPropertyKey_AllowTemporalCompression, + value: kCFBooleanTrue + ) guard err == noErr else { print("Warning: VTSessionSetProperty(kVTCompressionPropertyKey_AllowTemporalCompression) failed (\(err))") throw NSError(domain: NSOSStatusErrorDomain, code: Int(err)) } - + // Disable frame reordering - err = VTSessionSetProperty(compressionSession, key: kVTCompressionPropertyKey_AllowFrameReordering, value: kCFBooleanFalse) + err = VTSessionSetProperty( + compressionSession, + key: kVTCompressionPropertyKey_AllowFrameReordering, + value: kCFBooleanFalse + ) guard err == noErr else { print("Warning: VTSessionSetProperty(kVTCompressionPropertyKey_AllowFrameReordering) failed (\(err))") throw NSError(domain: NSOSStatusErrorDomain, code: Int(err)) } // Require key frames every 2 seconds - err = VTSessionSetProperty(compressionSession, key: kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration, value: 2 as CFNumber) + err = VTSessionSetProperty( + compressionSession, + key: kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration, + value: 2 as CFNumber + ) guard err == noErr else { print("Warning: VTSessionSetProperty(kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration) failed (\(err))") throw NSError(domain: NSOSStatusErrorDomain, code: Int(err)) } } - + private func reconfigureSession() { - let activeCamera = self.activeCamera - + let activeCamera = activeCamera + queue.async(qos: .userInitiated) { [self] in guard let session = captureSession else { return @@ -239,7 +253,7 @@ class CameraManager: NSObject, ObservableObject { session.beginConfiguration() do { try configureInputs(in: session, for: activeCamera) - } catch let error { + } catch { print("error changing session: \(error)") } session.sessionPreset = useVideoCompression ? .high : .medium @@ -250,14 +264,15 @@ class CameraManager: NSObject, ObservableObject { } extension CameraManager: AVCaptureVideoDataOutputSampleBufferDelegate { - func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) { + func captureOutput(_: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from _: AVCaptureConnection) { guard let imageBuffer = sampleBuffer.imageBuffer else { print("no image buffer :(") return } - + if let matrixData = sampleBuffer.attachments[.cameraIntrinsicMatrix]?.value as? Data, - matrixData.count == MemoryLayout.size { + matrixData.count == MemoryLayout.size + { let matrix = matrixData.withUnsafeBytes { $0.load(as: matrix_float3x3.self) } let width = CVPixelBufferGetWidth(imageBuffer) let height = CVPixelBufferGetHeight(imageBuffer) @@ -265,7 +280,7 @@ extension CameraManager: AVCaptureVideoDataOutputSampleBufferDelegate { calibrationData.send(CalibrationData(intrinsicMatrix: matrix, width: width, height: height)) } } - + if !useVideoCompression { let img = UIImage(ciImage: CIImage(cvImageBuffer: imageBuffer)) guard let jpeg = img.jpegData(compressionQuality: 0.8) else { @@ -277,30 +292,30 @@ extension CameraManager: AVCaptureVideoDataOutputSampleBufferDelegate { } return } - + guard let compressionSession else { print("no compression session") return } - + var err: OSStatus - + err = VTCompressionSessionEncodeFrame( compressionSession, imageBuffer: imageBuffer, presentationTimeStamp: sampleBuffer.presentationTimeStamp, duration: .invalid, frameProperties: [ - kVTEncodeFrameOptionKey_ForceKeyFrame: forceKeyFrame ? kCFBooleanTrue : kCFBooleanFalse + kVTEncodeFrameOptionKey_ForceKeyFrame: forceKeyFrame ? kCFBooleanTrue : kCFBooleanFalse, ] as CFDictionary, infoFlagsOut: nil - ) { [self] (status, infoFlags, sampleBuffer) in + ) { [self] status, infoFlags, sampleBuffer in queue.async(qos: .userInteractive) { [self] in if infoFlags.contains(.frameDropped) { print("Encoder dropped the frame with status \(status)") return } - + guard status == noErr else { forceKeyFrame = true print("Encoder returned an error for frame with \(status)") @@ -313,24 +328,24 @@ extension CameraManager: AVCaptureVideoDataOutputSampleBufferDelegate { print("Encoder returned an unexpected NULL sampleBuffer for frame") return } - + guard let annexBData = sampleBuffer.dataBufferAsAnnexB() else { print("Unable to translate to Annex B format") forceKeyFrame = true return } - + forceKeyFrame = false Task { @MainActor in h264Frames.send(annexBData) } } } - + guard err == noErr else { forceKeyFrame = true print("Encode call failed: \(err) \(NSError(domain: NSOSStatusErrorDomain, code: Int(err)))") - + // When the app is backgrounded and comes back to the foreground, // the compression session becomes invalid, so we recreate it if err == kVTInvalidSessionErr, let videoOutput { @@ -357,7 +372,7 @@ extension CameraManager: AVCaptureVideoDataOutputSampleBufferDelegate { } } - func captureOutput(_ output: AVCaptureOutput, didDrop sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) { + func captureOutput(_: AVCaptureOutput, didDrop _: CMSampleBuffer, from _: AVCaptureConnection) { Task { @MainActor in droppedFrames += 1 } @@ -374,12 +389,12 @@ extension CMSampleBuffer { do { var result = Data() let startCode = Data([0x00, 0x00, 0x00, 0x01]) - + try formatDescription.forEachParameterSet { buf in result.append(startCode) result.append(buf) } - + try dataBuffer.withContiguousStorage { rawBuffer in // Since the startCode is 4 bytes, we can append the whole AVCC buffer to the output, // and then replace the 4-byte length values with start codes. @@ -387,13 +402,16 @@ extension CMSampleBuffer { result.append(rawBuffer.assumingMemoryBound(to: UInt8.self)) result.withUnsafeMutableBytes { resultBuffer in while offset + 4 < resultBuffer.count { - let nalUnitLength = Int(UInt32(bigEndian: resultBuffer.loadUnaligned(fromByteOffset: offset, as: UInt32.self))) - resultBuffer[offset..? = nil + + for idx in 0 ..< parameterSetCount { + var ptr: UnsafePointer? var size = 0 status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex( self, diff --git a/WebSocketDemo-Shared/CardToggle.swift b/WebSocketDemo-Shared/CardToggle.swift index c835d46..865682e 100644 --- a/WebSocketDemo-Shared/CardToggle.swift +++ b/WebSocketDemo-Shared/CardToggle.swift @@ -9,8 +9,8 @@ struct CardToggle: View { @Environment(\.isEnabled) var isEnabled - internal init(isOn: Binding, dashed: Bool = false, @ViewBuilder content: @escaping () -> Content) { - self._isOn = isOn + init(isOn: Binding, dashed: Bool = false, @ViewBuilder content: @escaping () -> Content) { + _isOn = isOn self.dashed = dashed self.content = content } diff --git a/WebSocketDemo-Shared/ContentView.swift b/WebSocketDemo-Shared/ContentView.swift index b41dcbb..cb54e67 100644 --- a/WebSocketDemo-Shared/ContentView.swift +++ b/WebSocketDemo-Shared/ContentView.swift @@ -1,6 +1,6 @@ -import SwiftUI import Charts import StoreKit +import SwiftUI private let isAppClip = Bundle.main.bundleIdentifier?.hasSuffix("appclip") ?? false private let feedbackGenerator = UINotificationFeedbackGenerator() @@ -44,9 +44,9 @@ public struct ContentView: View { .onAppear { onboardingShown = !onboardingCompleted } - .sheet(isPresented: $onboardingShown, onDismiss: { + .sheet(isPresented: $onboardingShown) { onboardingCompleted = true - }) { + } content: { OnboardingView( isConnected: !server.clientEndpointNames.isEmpty, serverURL: server.addresses.first.flatMap { @@ -130,25 +130,25 @@ public struct ContentView: View { } } /* - CardToggle(isOn: $server.sendWatchData, dashed: isAppClip) { - Text("Heart Rate (Apple Watch)") - .multilineTextAlignment(.center) - if isAppClip { - Text("Requires full app") - .font(.caption) - .foregroundColor(.secondary) - } - }.disabled(isAppClip) - .onTapGesture { - if isAppClip && !appStoreOverlayShown { - appStoreOverlayShown = true - feedbackGenerator.notificationOccurred(.warning) - } - } - .appStoreOverlay(isPresented: $appStoreOverlayShown) { - SKOverlay.AppClipConfiguration(position: .bottom) - } - */ + CardToggle(isOn: $server.sendWatchData, dashed: isAppClip) { + Text("Heart Rate (Apple Watch)") + .multilineTextAlignment(.center) + if isAppClip { + Text("Requires full app") + .font(.caption) + .foregroundColor(.secondary) + } + }.disabled(isAppClip) + .onTapGesture { + if isAppClip && !appStoreOverlayShown { + appStoreOverlayShown = true + feedbackGenerator.notificationOccurred(.warning) + } + } + .appStoreOverlay(isPresented: $appStoreOverlayShown) { + SKOverlay.AppClipConfiguration(position: .bottom) + } + */ }.padding() } } @@ -158,7 +158,7 @@ public struct ContentView: View { if let port = server.actualPort { Section { let addrs = Array(server.addresses.enumerated()) - ForEach(addrs, id: \.offset) { (_, addr) in + ForEach(addrs, id: \.offset) { _, addr in IPAddressRow(address: addr, port: port) } } header: { @@ -186,7 +186,8 @@ public struct ContentView: View { } footer: { let info = Bundle.main.infoDictionary if let version = info?["CFBundleShortVersionString"] as? String, - let build = info?["CFBundleVersion"] as? String { + let build = info?["CFBundleVersion"] as? String + { Text("Version \(version) (\(build))") .frame(maxWidth: .infinity) } diff --git a/WebSocketDemo-Shared/FoxgloveServer.swift b/WebSocketDemo-Shared/FoxgloveServer.swift index 0791504..a7c2bea 100644 --- a/WebSocketDemo-Shared/FoxgloveServer.swift +++ b/WebSocketDemo-Shared/FoxgloveServer.swift @@ -1,20 +1,23 @@ -import Network -import Foundation import CoreMotion +import Foundation +import Network + +// swiftlint:disable:next blanket_disable_command +// swiftlint:disable force_try todo extension NWConnection: Hashable, Comparable, Identifiable { public static func < (lhs: NWConnection, rhs: NWConnection) -> Bool { switch (lhs.endpoint, rhs.endpoint) { - case (.hostPort(let host1, _), .hostPort(host: let host2, _)): - return host1.debugDescription < host2.debugDescription + case let (.hostPort(host1, _), .hostPort(host: host2, _)): + host1.debugDescription < host2.debugDescription default: - return ObjectIdentifier(lhs) < ObjectIdentifier(rhs) + ObjectIdentifier(lhs) < ObjectIdentifier(rhs) } } public static func == (lhs: NWConnection, rhs: NWConnection) -> Bool { - return lhs === rhs + lhs === rhs } public func hash(into hasher: inout Hasher) { @@ -22,7 +25,7 @@ extension NWConnection: Hashable, Comparable, Identifiable { } public var id: ObjectIdentifier { - return ObjectIdentifier(self) + ObjectIdentifier(self) } } @@ -37,7 +40,7 @@ class ClientInfo { init(connection: NWConnection) { self.connection = connection - self.name = connection.endpoint.debugDescription + name = connection.endpoint.debugDescription } } @@ -62,7 +65,7 @@ class FoxgloveServer: ObservableObject { @MainActor var clientEndpointNames: [String] { - return clients.keys.sorted().map { $0.endpoint.debugDescription } + clients.keys.sorted().map(\.endpoint.debugDescription) } @MainActor var channels: [ChannelID: Channel] = [:] @@ -74,7 +77,7 @@ class FoxgloveServer: ObservableObject { print(params.defaultProtocolStack.applicationProtocols) let opts = NWProtocolWebSocket.Options() - opts.setClientRequestHandler(queue) { subprotocols, additionalHeaders in + opts.setClientRequestHandler(queue) { subprotocols, _ in let subproto = "foxglove.websocket.v1" if subprotocols.contains(subproto) { return NWProtocolWebSocket.Response(status: .accept, subprotocol: subproto) @@ -103,7 +106,7 @@ class FoxgloveServer: ObservableObject { self?.handleNewConnection(newConnection) } listener.start(queue: queue) - } catch let error { + } catch { print("Error \(error)") } } @@ -122,7 +125,7 @@ class FoxgloveServer: ObservableObject { self.handleClientMessage(info, data, context, isComplete, error) receive() } - //TODO: emit error + // TODO: emit error if let error { print("receive error: \(error)") } @@ -135,12 +138,11 @@ class FoxgloveServer: ObservableObject { self.sendInfo(connection) } - let closed: Bool - switch connection.state { - case .cancelled, .failed(_): - closed = true + let closed: Bool = switch connection.state { + case .cancelled, .failed: + true default: - closed = false + false } Task { @MainActor in @@ -174,10 +176,9 @@ class FoxgloveServer: ObservableObject { } receive() - connection.start(queue: self.queue) + connection.start(queue: queue) } - static let binaryMessage = NWConnection.ContentContext(identifier: "", metadata: [ NWProtocolWebSocket.Metadata(opcode: .binary), ]) @@ -226,7 +227,7 @@ class FoxgloveServer: ObservableObject { "schema": schema, ], ], to: conn) - } catch let error { + } catch { // TODO: emit error print("addchannel error: \(error)") } @@ -235,7 +236,6 @@ class FoxgloveServer: ObservableObject { return newID } - /** * Remove a previously advertised channel and inform any connected clients. */ @@ -253,13 +253,13 @@ class FoxgloveServer: ObservableObject { } do { - //TODO: serialize once + // TODO: serialize once try sendJson([ "op": "unadvertise", "channelIds": [channelID], ], to: conn) - } catch let error { - //TODO: emit error + } catch { + // TODO: emit error print("remove error \(error)") } } @@ -278,53 +278,74 @@ class FoxgloveServer: ObservableObject { } } - private func sendMessageData(on connection: NWConnection, subscriptionID: SubscriptionID, timestamp: UInt64, payload: Data) { + private func sendMessageData( + on connection: NWConnection, + subscriptionID: SubscriptionID, + timestamp: UInt64, + payload: Data + ) { var header = Data(count: 1 + 4 + 8) header[0] = BinaryOpcode.messageData.rawValue withUnsafeBytes(of: subscriptionID.littleEndian) { - header.replaceSubrange(1..<5, with: $0.baseAddress!, count: $0.count) + header.replaceSubrange(1 ..< 5, with: $0.baseAddress!, count: $0.count) } withUnsafeBytes(of: timestamp.littleEndian) { - header.replaceSubrange(5..<13, with: $0.baseAddress!, count: $0.count) + header.replaceSubrange(5 ..< 13, with: $0.baseAddress!, count: $0.count) } - connection.send(content: header, contentContext: Self.binaryMessage, isComplete: false, completion: .contentProcessed { error in - if let error = error { - print("error sending1: \(error)") + connection.send( + content: header, + contentContext: Self.binaryMessage, + isComplete: false, + completion: .contentProcessed { error in + if let error { + print("error sending1: \(error)") + } } - }) - connection.send(content: payload, contentContext: Self.binaryMessage, isComplete: true, completion: .contentProcessed { error in - if let error = error { - print("error sending2: \(error)") + ) + connection.send( + content: payload, + contentContext: Self.binaryMessage, + isComplete: true, + completion: .contentProcessed { error in + if let error { + print("error sending2: \(error)") + } } - }) + ) } private func sendJson(_ obj: Any, to connection: NWConnection) throws { let data = try JSONSerialization.data(withJSONObject: obj) - connection.send(content: data, contentContext: Self.jsonMessage, completion: .contentProcessed({ error in + connection.send(content: data, contentContext: Self.jsonMessage, completion: .contentProcessed { error in if let error { print("send error: \(error)") } - })) + }) } private func sendBinary(_ data: Data, to connection: NWConnection) throws { - connection.send(content: data, contentContext: Self.binaryMessage, completion: .contentProcessed({ error in + connection.send(content: data, contentContext: Self.binaryMessage, completion: .contentProcessed { error in if let error { print("send error: \(error)") } - })) + }) } - private func handleClientMessage(_ client: ClientInfo, _ data: Data, _ context: NWConnection.ContentContext, _ isComplete: Bool, _ error: NWError?) { + private func handleClientMessage( + _ client: ClientInfo, + _ data: Data, + _ context: NWConnection.ContentContext, + _: Bool, + _ error: NWError? + ) { do { let metadata = context.protocolMetadata(definition: NWProtocolWebSocket.definition) let isText = (metadata as? NWProtocolWebSocket.Metadata)?.opcode == .text if isText { let msg = try JSONDecoder().decode(ClientMessage.self, from: data) switch msg { - case .subscribe(let msg): + case let .subscribe(msg): Task { @MainActor in for sub in msg.subscriptions { // TODO: emit status messages for warnings (see TS impl) @@ -338,15 +359,15 @@ class FoxgloveServer: ObservableObject { } // TODO: emit subscribe } - case .unsubscribe(let msg): + case let .unsubscribe(msg): Task { @MainActor in for sub in msg.subscriptionIds { guard let chanID = client.subscriptions[sub] else { - //TODO: error + // TODO: error continue } client.subscriptions[sub] = nil - //TODO: cleanup index usage? + // TODO: cleanup index usage? client.subscriptionsByChannel[chanID]?.remove(sub) if client.subscriptionsByChannel[chanID]?.isEmpty == true { client.subscriptionsByChannel[chanID] = nil @@ -361,8 +382,8 @@ class FoxgloveServer: ObservableObject { } else { print("Got client message: data \(data)") } - } catch let error { - //TODO: emit error + } catch { + // TODO: emit error print("client msg error: \(error)") } } @@ -382,6 +403,7 @@ struct Subscribe: Decodable { let id: SubscriptionID let channelId: ChannelID } + let subscriptions: [Subscription] } @@ -401,8 +423,8 @@ enum ClientMessage: Decodable { init(from decoder: Decoder) throws { let op = try decoder.container(keyedBy: CodingKeys.self).decode(String.self, forKey: .op) switch ClientOp(rawValue: op) { - case .subscribe: self = .subscribe(try Subscribe(from: decoder)) - case .unsubscribe: self = .unsubscribe(try Unsubscribe(from: decoder)) + case .subscribe: self = try .subscribe(Subscribe(from: decoder)) + case .unsubscribe: self = try .unsubscribe(Unsubscribe(from: decoder)) case nil: throw FoxgloveServerError.unrecognizedOpcode(op) } diff --git a/WebSocketDemo-Shared/IPAddressRow.swift b/WebSocketDemo-Shared/IPAddressRow.swift index a5ffa29..552d692 100644 --- a/WebSocketDemo-Shared/IPAddressRow.swift +++ b/WebSocketDemo-Shared/IPAddressRow.swift @@ -1,9 +1,9 @@ -import SwiftUI import Network +import SwiftUI extension IPAddress { var withoutInterface: IPAddress { - return Self.init(rawValue, nil) ?? self + Self(rawValue, nil) ?? self } var urlString: String { @@ -24,17 +24,17 @@ struct IPAddressRow: View { var icon: Text { switch address.interface?.type { case .wifi?: - return Text(Image(systemName: "wifi")) + Text(Image(systemName: "wifi")) case .wiredEthernet?: - return Text(Image(systemName: "cable.connector.horizontal")) + Text(Image(systemName: "cable.connector.horizontal")) case .cellular?: - return Text(Image(systemName: "antenna.radiowaves.left.and.right")) + Text(Image(systemName: "antenna.radiowaves.left.and.right")) case .loopback?: - return Text(Image(systemName: "arrow.counterclockwise")) + Text(Image(systemName: "arrow.counterclockwise")) case .other?: - return Text(Image(systemName: "questionmark")) + Text(Image(systemName: "questionmark")) default: - return Text("") + Text("") } } @@ -63,7 +63,7 @@ struct IPAddressRow: View { var url = URL(string: "https://studio.foxglove.dev/")! url.append(queryItems: [ URLQueryItem(name: "ds", value: "foxglove-websocket"), - URLQueryItem(name: "ds.url", value: "ws://\(address.withoutInterface.urlString):\(String(port.rawValue))") + URLQueryItem(name: "ds.url", value: "ws://\(address.withoutInterface.urlString):\(String(port.rawValue))"), ]) return url }() diff --git a/WebSocketDemo-Shared/Onboarding/ConnectionView.swift b/WebSocketDemo-Shared/Onboarding/ConnectionView.swift index b7f63ca..90b43b1 100644 --- a/WebSocketDemo-Shared/Onboarding/ConnectionView.swift +++ b/WebSocketDemo-Shared/Onboarding/ConnectionView.swift @@ -42,7 +42,7 @@ struct ConnectionView: View { } } } - .disabled(!isConnected) + .disabled(!isConnected) } var body: some View { @@ -94,7 +94,10 @@ struct ConnectionView: View { .foregroundColor(.secondary) .font(.system(size: bulletSize)) VStack(alignment: .leading, spacing: 6) { - Text("Click the \(Image(systemName: "shield.lefthalf.filled")) icon in the address bar, then click “Load Unsafe Scripts”") + Text( + // swiftlint:disable:next line_length + "Click the \(Image(systemName: "shield.lefthalf.filled")) icon in the address bar, then click “Load Unsafe Scripts”" + ) Text("This setting allows a “`https://`” page to connect to a “`ws://`” URL") .font(.caption) .foregroundColor(.secondary) diff --git a/WebSocketDemo-Shared/Onboarding/ContinueButton.swift b/WebSocketDemo-Shared/Onboarding/ContinueButton.swift index 5bcb572..afd3d24 100644 --- a/WebSocketDemo-Shared/Onboarding/ContinueButton.swift +++ b/WebSocketDemo-Shared/Onboarding/ContinueButton.swift @@ -13,7 +13,7 @@ extension EnvironmentValues { extension View { func onContinue(_ action: @escaping () -> Void) -> some View { - self.environment(\.onContinue, action) + environment(\.onContinue, action) } } diff --git a/WebSocketDemo-Shared/Onboarding/IntroView.swift b/WebSocketDemo-Shared/Onboarding/IntroView.swift index f7e2ac0..e85a43c 100644 --- a/WebSocketDemo-Shared/Onboarding/IntroView.swift +++ b/WebSocketDemo-Shared/Onboarding/IntroView.swift @@ -1,11 +1,11 @@ import SwiftUI -fileprivate class Dummy {} +private class Dummy {} extension Text { // https://stackoverflow.com/a/64731044/23649 func fixedHeight() -> some View { - self.fixedSize(horizontal: false, vertical: true) + fixedSize(horizontal: false, vertical: true) } } @@ -63,8 +63,8 @@ struct IntroView: View { Spacer(minLength: 16).fixedSize() Text(""" -Stream data from your \(deviceModel)’s built-in sensors to Foxglove Studio for instant visualization. -""") + Stream data from your \(deviceModel)’s built-in sensors to Foxglove Studio for instant visualization. + """) .fixedHeight() .lineSpacing(4) diff --git a/WebSocketDemo-Shared/Onboarding/OnboardingView.swift b/WebSocketDemo-Shared/Onboarding/OnboardingView.swift index 542cf02..3aebce6 100644 --- a/WebSocketDemo-Shared/Onboarding/OnboardingView.swift +++ b/WebSocketDemo-Shared/Onboarding/OnboardingView.swift @@ -54,7 +54,7 @@ struct OnboardingStepWrapper: View { .multilineTextAlignment(.center) .padding(.horizontal, 32) .padding(.bottom, 32) - // Ensure the content takes up at least one full page in the scroll view + // Ensure the content takes up at least one full page in the scroll view .frame(maxWidth: .infinity, minHeight: proxy.size.height) } } diff --git a/WebSocketDemo-Shared/Onboarding/StudioUsageView.swift b/WebSocketDemo-Shared/Onboarding/StudioUsageView.swift index f154924..cfc4d77 100644 --- a/WebSocketDemo-Shared/Onboarding/StudioUsageView.swift +++ b/WebSocketDemo-Shared/Onboarding/StudioUsageView.swift @@ -1,10 +1,10 @@ -import SwiftUI import SafariServices +import SwiftUI struct SafariView: UIViewControllerRepresentable { let url: URL - func makeUIViewController(context: Context) -> SFSafariViewController { + func makeUIViewController(context _: Context) -> SFSafariViewController { let config = SFSafariViewController.Configuration() // Bar collapsing looks buggy when presented in a sheet. config.barCollapsingEnabled = false @@ -12,7 +12,7 @@ struct SafariView: UIViewControllerRepresentable { return SFSafariViewController(url: url, configuration: config) } - func updateUIViewController(_ uiViewController: SFSafariViewController, context: Context) { + func updateUIViewController(_: SFSafariViewController, context _: Context) { print("Warning: unable to update SFSafariViewController") } } @@ -92,8 +92,10 @@ struct StudioUsageView: View { Spacer(minLength: 32).fixedSize() Text(""" -Try adding the **3D**, **Image**, **Map**, and **Plot** panels to your layout to start exploring your \(deviceModel)’s sensor data. -""") + Try adding the **3D**, **Image**, **Map**, and **Plot** panels to your layout to start exploring your \( + deviceModel + )’s sensor data. + """) Spacer(minLength: 32).fixedSize() Button("View Docs") { showDocs = true diff --git a/WebSocketDemo-Shared/Schemas/foxglove/ArrowPrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/ArrowPrimitive.pb.swift index cb2db91..dda4595 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/ArrowPrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/ArrowPrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -28,15 +28,17 @@ struct Foxglove_ArrowPrimitive { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - /// Position of the arrow's tail and orientation of the arrow. Identity orientation means the arrow points in the +x direction. + /// Position of the arrow's tail and orientation of the arrow. Identity orientation means the arrow points in the +x + /// direction. var pose: Foxglove_Pose { - get {return _pose ?? Foxglove_Pose()} - set {_pose = newValue} + get { _pose ?? Foxglove_Pose() } + set { _pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return self._pose != nil} + var hasPose: Bool { _pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {self._pose = nil} + mutating func clearPose() { _pose = nil } /// Length of the arrow shaft var shaftLength: Double = 0 @@ -52,31 +54,34 @@ struct Foxglove_ArrowPrimitive { /// Color of the arrow var color: Foxglove_Color { - get {return _color ?? Foxglove_Color()} - set {_color = newValue} + get { _color ?? Foxglove_Color() } + set { _color = newValue } } + /// Returns true if `color` has been explicitly set. - var hasColor: Bool {return self._color != nil} + var hasColor: Bool { _color != nil } /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() {self._color = nil} + mutating func clearColor() { _color = nil } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _pose: Foxglove_Pose? = nil - fileprivate var _color: Foxglove_Color? = nil + private var _pose: Foxglove_Pose? + private var _color: Foxglove_Color? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_ArrowPrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_ArrowPrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_ArrowPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_ArrowPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".ArrowPrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -87,42 +92,42 @@ extension Foxglove_ArrowPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message 6: .same(proto: "color"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() - case 2: try { try decoder.decodeSingularDoubleField(value: &self.shaftLength) }() - case 3: try { try decoder.decodeSingularDoubleField(value: &self.shaftDiameter) }() - case 4: try { try decoder.decodeSingularDoubleField(value: &self.headLength) }() - case 5: try { try decoder.decodeSingularDoubleField(value: &self.headDiameter) }() - case 6: try { try decoder.decodeSingularMessageField(value: &self._color) }() + case 1: try decoder.decodeSingularMessageField(value: &_pose) + case 2: try decoder.decodeSingularDoubleField(value: &shaftLength) + case 3: try decoder.decodeSingularDoubleField(value: &shaftDiameter) + case 4: try decoder.decodeSingularDoubleField(value: &headLength) + case 5: try decoder.decodeSingularDoubleField(value: &headDiameter) + case 6: try decoder.decodeSingularMessageField(value: &_color) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._pose { + if let v = _pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if self.shaftLength != 0 { - try visitor.visitSingularDoubleField(value: self.shaftLength, fieldNumber: 2) } - if self.shaftDiameter != 0 { - try visitor.visitSingularDoubleField(value: self.shaftDiameter, fieldNumber: 3) + if shaftLength != 0 { + try visitor.visitSingularDoubleField(value: shaftLength, fieldNumber: 2) + } + if shaftDiameter != 0 { + try visitor.visitSingularDoubleField(value: shaftDiameter, fieldNumber: 3) } - if self.headLength != 0 { - try visitor.visitSingularDoubleField(value: self.headLength, fieldNumber: 4) + if headLength != 0 { + try visitor.visitSingularDoubleField(value: headLength, fieldNumber: 4) } - if self.headDiameter != 0 { - try visitor.visitSingularDoubleField(value: self.headDiameter, fieldNumber: 5) + if headDiameter != 0 { + try visitor.visitSingularDoubleField(value: headDiameter, fieldNumber: 5) } try { if let v = self._color { try visitor.visitSingularMessageField(value: v, fieldNumber: 6) @@ -130,14 +135,14 @@ extension Foxglove_ArrowPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_ArrowPrimitive, rhs: Foxglove_ArrowPrimitive) -> Bool { - if lhs._pose != rhs._pose {return false} - if lhs.shaftLength != rhs.shaftLength {return false} - if lhs.shaftDiameter != rhs.shaftDiameter {return false} - if lhs.headLength != rhs.headLength {return false} - if lhs.headDiameter != rhs.headDiameter {return false} - if lhs._color != rhs._color {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_ArrowPrimitive, rhs: Foxglove_ArrowPrimitive) -> Bool { + if lhs._pose != rhs._pose { return false } + if lhs.shaftLength != rhs.shaftLength { return false } + if lhs.shaftDiameter != rhs.shaftDiameter { return false } + if lhs.headLength != rhs.headLength { return false } + if lhs.headDiameter != rhs.headDiameter { return false } + if lhs._color != rhs._color { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CameraCalibration.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CameraCalibration.pb.swift index 9ebecdc..fa50305 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CameraCalibration.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CameraCalibration.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,16 +30,18 @@ struct Foxglove_CameraCalibration { /// Timestamp of calibration data var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } - /// Frame of reference for the camera. The origin of the frame is the optical center of the camera. +x points to the right in the image, +y points down, and +z points into the plane of the image. - var frameID: String = String() + /// Frame of reference for the camera. The origin of the frame is the optical center of the camera. +x points to the + /// right in the image, +y points down, and +z points into the plane of the image. + var frameID: String = .init() /// Image width var width: UInt32 = 0 @@ -48,19 +50,20 @@ struct Foxglove_CameraCalibration { var height: UInt32 = 0 /// Name of distortion model - /// + /// /// Supported values: `plumb_bob` and `rational_polynomial` - var distortionModel: String = String() + var distortionModel: String = .init() /// Distortion parameters var d: [Double] = [] /// Intrinsic camera matrix (3x3 row-major matrix) - /// + /// /// A 3x3 row-major matrix for the raw (distorted) image. - /// - /// Projects 3D points in the camera coordinate frame to 2D pixel coordinates using the focal lengths (fx, fy) and principal point (cx, cy). - /// + /// + /// Projects 3D points in the camera coordinate frame to 2D pixel coordinates using the focal lengths (fx, fy) and + /// principal point (cx, cy). + /// /// ``` /// [fx 0 cx] /// K = [ 0 fy cy] @@ -69,34 +72,41 @@ struct Foxglove_CameraCalibration { var k: [Double] = [] /// Rectification matrix (stereo cameras only, 3x3 row-major matrix) - /// - /// A rotation matrix aligning the camera coordinate system to the ideal stereo image plane so that epipolar lines in both stereo images are parallel. + /// + /// A rotation matrix aligning the camera coordinate system to the ideal stereo image plane so that epipolar lines in + /// both stereo images are parallel. var r: [Double] = [] /// Projection/camera matrix (3x4 row-major matrix) - /// + /// /// ``` /// [fx' 0 cx' Tx] /// P = [ 0 fy' cy' Ty] /// [ 0 0 1 0] /// ``` - /// - /// By convention, this matrix specifies the intrinsic (camera) matrix of the processed (rectified) image. That is, the left 3x3 portion is the normal camera intrinsic matrix for the rectified image. - /// - /// It projects 3D points in the camera coordinate frame to 2D pixel coordinates using the focal lengths (fx', fy') and principal point (cx', cy') - these may differ from the values in K. - /// - /// For monocular cameras, Tx = Ty = 0. Normally, monocular cameras will also have R = the identity and P[1:3,1:3] = K. - /// - /// For a stereo pair, the fourth column [Tx Ty 0]' is related to the position of the optical center of the second camera in the first camera's frame. We assume Tz = 0 so both cameras are in the same stereo image plane. The first camera always has Tx = Ty = 0. For the right (second) camera of a horizontal stereo pair, Ty = 0 and Tx = -fx' * B, where B is the baseline between the cameras. - /// + /// + /// By convention, this matrix specifies the intrinsic (camera) matrix of the processed (rectified) image. That is, + /// the left 3x3 portion is the normal camera intrinsic matrix for the rectified image. + /// + /// It projects 3D points in the camera coordinate frame to 2D pixel coordinates using the focal lengths (fx', fy') + /// and principal point (cx', cy') - these may differ from the values in K. + /// + /// For monocular cameras, Tx = Ty = 0. Normally, monocular cameras will also have R = the identity and P[1:3,1:3] = + /// K. + /// + /// For a stereo pair, the fourth column [Tx Ty 0]' is related to the position of the optical center of the second + /// camera in the first camera's frame. We assume Tz = 0 so both cameras are in the same stereo image plane. The first + /// camera always has Tx = Ty = 0. For the right (second) camera of a horizontal stereo pair, Ty = 0 and Tx = -fx' * + /// B, where B is the baseline between the cameras. + /// /// Given a 3D point [X Y Z]', the projection (x, y) of the point onto the rectified image is given by: - /// + /// /// ``` /// [u v w]' = P * [X Y Z 1]' /// x = u / w /// y = v / w /// ``` - /// + /// /// This holds for both images of a stereo pair. var p: [Double] = [] @@ -104,18 +114,20 @@ struct Foxglove_CameraCalibration { init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_CameraCalibration: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_CameraCalibration: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_CameraCalibration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_CameraCalibration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".CameraCalibration" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -129,72 +141,72 @@ extension Foxglove_CameraCalibration: SwiftProtobuf.Message, SwiftProtobuf._Mess 8: .same(proto: "P"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularFixed32Field(value: &self.width) }() - case 3: try { try decoder.decodeSingularFixed32Field(value: &self.height) }() - case 4: try { try decoder.decodeSingularStringField(value: &self.distortionModel) }() - case 5: try { try decoder.decodeRepeatedDoubleField(value: &self.d) }() - case 6: try { try decoder.decodeRepeatedDoubleField(value: &self.k) }() - case 7: try { try decoder.decodeRepeatedDoubleField(value: &self.r) }() - case 8: try { try decoder.decodeRepeatedDoubleField(value: &self.p) }() - case 9: try { try decoder.decodeSingularStringField(value: &self.frameID) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularFixed32Field(value: &width) + case 3: try decoder.decodeSingularFixed32Field(value: &height) + case 4: try decoder.decodeSingularStringField(value: &distortionModel) + case 5: try decoder.decodeRepeatedDoubleField(value: &d) + case 6: try decoder.decodeRepeatedDoubleField(value: &k) + case 7: try decoder.decodeRepeatedDoubleField(value: &r) + case 8: try decoder.decodeRepeatedDoubleField(value: &p) + case 9: try decoder.decodeSingularStringField(value: &frameID) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if self.width != 0 { - try visitor.visitSingularFixed32Field(value: self.width, fieldNumber: 2) } - if self.height != 0 { - try visitor.visitSingularFixed32Field(value: self.height, fieldNumber: 3) + if width != 0 { + try visitor.visitSingularFixed32Field(value: width, fieldNumber: 2) + } + if height != 0 { + try visitor.visitSingularFixed32Field(value: height, fieldNumber: 3) } - if !self.distortionModel.isEmpty { - try visitor.visitSingularStringField(value: self.distortionModel, fieldNumber: 4) + if !distortionModel.isEmpty { + try visitor.visitSingularStringField(value: distortionModel, fieldNumber: 4) } - if !self.d.isEmpty { - try visitor.visitPackedDoubleField(value: self.d, fieldNumber: 5) + if !d.isEmpty { + try visitor.visitPackedDoubleField(value: d, fieldNumber: 5) } - if !self.k.isEmpty { - try visitor.visitPackedDoubleField(value: self.k, fieldNumber: 6) + if !k.isEmpty { + try visitor.visitPackedDoubleField(value: k, fieldNumber: 6) } - if !self.r.isEmpty { - try visitor.visitPackedDoubleField(value: self.r, fieldNumber: 7) + if !r.isEmpty { + try visitor.visitPackedDoubleField(value: r, fieldNumber: 7) } - if !self.p.isEmpty { - try visitor.visitPackedDoubleField(value: self.p, fieldNumber: 8) + if !p.isEmpty { + try visitor.visitPackedDoubleField(value: p, fieldNumber: 8) } - if !self.frameID.isEmpty { - try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 9) + if !frameID.isEmpty { + try visitor.visitSingularStringField(value: frameID, fieldNumber: 9) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_CameraCalibration, rhs: Foxglove_CameraCalibration) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.frameID != rhs.frameID {return false} - if lhs.width != rhs.width {return false} - if lhs.height != rhs.height {return false} - if lhs.distortionModel != rhs.distortionModel {return false} - if lhs.d != rhs.d {return false} - if lhs.k != rhs.k {return false} - if lhs.r != rhs.r {return false} - if lhs.p != rhs.p {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_CameraCalibration, rhs: Foxglove_CameraCalibration) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.frameID != rhs.frameID { return false } + if lhs.width != rhs.width { return false } + if lhs.height != rhs.height { return false } + if lhs.distortionModel != rhs.distortionModel { return false } + if lhs.d != rhs.d { return false } + if lhs.k != rhs.k { return false } + if lhs.r != rhs.r { return false } + if lhs.p != rhs.p { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CircleAnnotation.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CircleAnnotation.pb.swift index 2ed930c..aecc294 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CircleAnnotation.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CircleAnnotation.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,23 +30,25 @@ struct Foxglove_CircleAnnotation { /// Timestamp of circle var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Center of the circle in 2D image coordinates (pixels) var position: Foxglove_Point2 { - get {return _position ?? Foxglove_Point2()} - set {_position = newValue} + get { _position ?? Foxglove_Point2() } + set { _position = newValue } } + /// Returns true if `position` has been explicitly set. - var hasPosition: Bool {return self._position != nil} + var hasPosition: Bool { _position != nil } /// Clears the value of `position`. Subsequent reads from it will return its default value. - mutating func clearPosition() {self._position = nil} + mutating func clearPosition() { _position = nil } /// Circle diameter in pixels var diameter: Double = 0 @@ -56,43 +58,47 @@ struct Foxglove_CircleAnnotation { /// Fill color var fillColor: Foxglove_Color { - get {return _fillColor ?? Foxglove_Color()} - set {_fillColor = newValue} + get { _fillColor ?? Foxglove_Color() } + set { _fillColor = newValue } } + /// Returns true if `fillColor` has been explicitly set. - var hasFillColor: Bool {return self._fillColor != nil} + var hasFillColor: Bool { _fillColor != nil } /// Clears the value of `fillColor`. Subsequent reads from it will return its default value. - mutating func clearFillColor() {self._fillColor = nil} + mutating func clearFillColor() { _fillColor = nil } /// Outline color var outlineColor: Foxglove_Color { - get {return _outlineColor ?? Foxglove_Color()} - set {_outlineColor = newValue} + get { _outlineColor ?? Foxglove_Color() } + set { _outlineColor = newValue } } + /// Returns true if `outlineColor` has been explicitly set. - var hasOutlineColor: Bool {return self._outlineColor != nil} + var hasOutlineColor: Bool { _outlineColor != nil } /// Clears the value of `outlineColor`. Subsequent reads from it will return its default value. - mutating func clearOutlineColor() {self._outlineColor = nil} + mutating func clearOutlineColor() { _outlineColor = nil } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _position: Foxglove_Point2? = nil - fileprivate var _fillColor: Foxglove_Color? = nil - fileprivate var _outlineColor: Foxglove_Color? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + private var _position: Foxglove_Point2? + private var _fillColor: Foxglove_Color? + private var _outlineColor: Foxglove_Color? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_CircleAnnotation: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_CircleAnnotation: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_CircleAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_CircleAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".CircleAnnotation" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -103,39 +109,39 @@ extension Foxglove_CircleAnnotation: SwiftProtobuf.Message, SwiftProtobuf._Messa 6: .standard(proto: "outline_color"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._position) }() - case 3: try { try decoder.decodeSingularDoubleField(value: &self.diameter) }() - case 4: try { try decoder.decodeSingularDoubleField(value: &self.thickness) }() - case 5: try { try decoder.decodeSingularMessageField(value: &self._fillColor) }() - case 6: try { try decoder.decodeSingularMessageField(value: &self._outlineColor) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularMessageField(value: &_position) + case 3: try decoder.decodeSingularDoubleField(value: &diameter) + case 4: try decoder.decodeSingularDoubleField(value: &thickness) + case 5: try decoder.decodeSingularMessageField(value: &_fillColor) + case 6: try decoder.decodeSingularMessageField(value: &_outlineColor) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() + } try { if let v = self._position { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() - if self.diameter != 0 { - try visitor.visitSingularDoubleField(value: self.diameter, fieldNumber: 3) + if diameter != 0 { + try visitor.visitSingularDoubleField(value: diameter, fieldNumber: 3) } - if self.thickness != 0 { - try visitor.visitSingularDoubleField(value: self.thickness, fieldNumber: 4) + if thickness != 0 { + try visitor.visitSingularDoubleField(value: thickness, fieldNumber: 4) } try { if let v = self._fillColor { try visitor.visitSingularMessageField(value: v, fieldNumber: 5) @@ -146,14 +152,14 @@ extension Foxglove_CircleAnnotation: SwiftProtobuf.Message, SwiftProtobuf._Messa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_CircleAnnotation, rhs: Foxglove_CircleAnnotation) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs._position != rhs._position {return false} - if lhs.diameter != rhs.diameter {return false} - if lhs.thickness != rhs.thickness {return false} - if lhs._fillColor != rhs._fillColor {return false} - if lhs._outlineColor != rhs._outlineColor {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_CircleAnnotation, rhs: Foxglove_CircleAnnotation) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs._position != rhs._position { return false } + if lhs.diameter != rhs.diameter { return false } + if lhs.thickness != rhs.thickness { return false } + if lhs._fillColor != rhs._fillColor { return false } + if lhs._outlineColor != rhs._outlineColor { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Color.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Color.pb.swift index 79b6e07..c00709f 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Color.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Color.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -46,14 +46,16 @@ struct Foxglove_Color { } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_Color: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_Color: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_Color: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_Color: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".Color" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "r"), @@ -62,43 +64,43 @@ extension Foxglove_Color: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement 4: .same(proto: "a"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularDoubleField(value: &self.r) }() - case 2: try { try decoder.decodeSingularDoubleField(value: &self.g) }() - case 3: try { try decoder.decodeSingularDoubleField(value: &self.b) }() - case 4: try { try decoder.decodeSingularDoubleField(value: &self.a) }() + case 1: try decoder.decodeSingularDoubleField(value: &r) + case 2: try decoder.decodeSingularDoubleField(value: &g) + case 3: try decoder.decodeSingularDoubleField(value: &b) + case 4: try decoder.decodeSingularDoubleField(value: &a) default: break } } } - func traverse(visitor: inout V) throws { - if self.r != 0 { - try visitor.visitSingularDoubleField(value: self.r, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if r != 0 { + try visitor.visitSingularDoubleField(value: r, fieldNumber: 1) } - if self.g != 0 { - try visitor.visitSingularDoubleField(value: self.g, fieldNumber: 2) + if g != 0 { + try visitor.visitSingularDoubleField(value: g, fieldNumber: 2) } - if self.b != 0 { - try visitor.visitSingularDoubleField(value: self.b, fieldNumber: 3) + if b != 0 { + try visitor.visitSingularDoubleField(value: b, fieldNumber: 3) } - if self.a != 0 { - try visitor.visitSingularDoubleField(value: self.a, fieldNumber: 4) + if a != 0 { + try visitor.visitSingularDoubleField(value: a, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_Color, rhs: Foxglove_Color) -> Bool { - if lhs.r != rhs.r {return false} - if lhs.g != rhs.g {return false} - if lhs.b != rhs.b {return false} - if lhs.a != rhs.a {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_Color, rhs: Foxglove_Color) -> Bool { + if lhs.r != rhs.r { return false } + if lhs.g != rhs.g { return false } + if lhs.b != rhs.b { return false } + if lhs.a != rhs.a { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CompressedImage.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CompressedImage.pb.swift index 8db00e2..f77770d 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CompressedImage.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CompressedImage.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,41 +30,45 @@ struct Foxglove_CompressedImage { /// Timestamp of image var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } - /// Frame of reference for the image. The origin of the frame is the optical center of the camera. +x points to the right in the image, +y points down, and +z points into the plane of the image. - var frameID: String = String() + /// Frame of reference for the image. The origin of the frame is the optical center of the camera. +x points to the + /// right in the image, +y points down, and +z points into the plane of the image. + var frameID: String = .init() /// Compressed image data - var data: Data = Data() + var data: Data = .init() /// Image format - /// + /// /// Supported values: image media types supported by Chrome, such as `webp`, `jpeg`, `png` - var format: String = String() + var format: String = .init() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_CompressedImage: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_CompressedImage: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_CompressedImage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_CompressedImage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".CompressedImage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -73,47 +77,47 @@ extension Foxglove_CompressedImage: SwiftProtobuf.Message, SwiftProtobuf._Messag 3: .same(proto: "format"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.data) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.format) }() - case 4: try { try decoder.decodeSingularStringField(value: &self.frameID) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularBytesField(value: &data) + case 3: try decoder.decodeSingularStringField(value: &format) + case 4: try decoder.decodeSingularStringField(value: &frameID) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.data.isEmpty { - try visitor.visitSingularBytesField(value: self.data, fieldNumber: 2) } - if !self.format.isEmpty { - try visitor.visitSingularStringField(value: self.format, fieldNumber: 3) + if !data.isEmpty { + try visitor.visitSingularBytesField(value: data, fieldNumber: 2) + } + if !format.isEmpty { + try visitor.visitSingularStringField(value: format, fieldNumber: 3) } - if !self.frameID.isEmpty { - try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 4) + if !frameID.isEmpty { + try visitor.visitSingularStringField(value: frameID, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_CompressedImage, rhs: Foxglove_CompressedImage) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.frameID != rhs.frameID {return false} - if lhs.data != rhs.data {return false} - if lhs.format != rhs.format {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_CompressedImage, rhs: Foxglove_CompressedImage) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.frameID != rhs.frameID { return false } + if lhs.data != rhs.data { return false } + if lhs.format != rhs.format { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CompressedVideo.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CompressedVideo.pb.swift index b8c1cab..b554c8c 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CompressedVideo.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CompressedVideo.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,41 +30,47 @@ struct Foxglove_CompressedVideo { /// Timestamp of video frame var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } - /// Frame of reference for the video. The origin of the frame is the optical center of the camera. +x points to the right in the video, +y points down, and +z points into the plane of the video. - var frameID: String = String() + /// Frame of reference for the video. The origin of the frame is the optical center of the camera. +x points to the + /// right in the video, +y points down, and +z points into the plane of the video. + var frameID: String = .init() - /// Compressed video frame data. For packet-based video codecs this data must begin and end on packet boundaries (no partial packets), and must contain enough video packets to decode exactly one image (either a keyframe or delta frame). Note: Foxglove Studio does not support video streams that include B frames because they require lookahead. - var data: Data = Data() + /// Compressed video frame data. For packet-based video codecs this data must begin and end on packet boundaries (no + /// partial packets), and must contain enough video packets to decode exactly one image (either a keyframe or delta + /// frame). Note: Foxglove Studio does not support video streams that include B frames because they require lookahead. + var data: Data = .init() /// Video format - /// + /// /// Supported values: `h264` - var format: String = String() + var format: String = .init() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_CompressedVideo: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_CompressedVideo: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_CompressedVideo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_CompressedVideo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".CompressedVideo" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -73,47 +79,47 @@ extension Foxglove_CompressedVideo: SwiftProtobuf.Message, SwiftProtobuf._Messag 4: .same(proto: "format"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() - case 3: try { try decoder.decodeSingularBytesField(value: &self.data) }() - case 4: try { try decoder.decodeSingularStringField(value: &self.format) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularStringField(value: &frameID) + case 3: try decoder.decodeSingularBytesField(value: &data) + case 4: try decoder.decodeSingularStringField(value: &format) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.frameID.isEmpty { - try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) } - if !self.data.isEmpty { - try visitor.visitSingularBytesField(value: self.data, fieldNumber: 3) + if !frameID.isEmpty { + try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) + } + if !data.isEmpty { + try visitor.visitSingularBytesField(value: data, fieldNumber: 3) } - if !self.format.isEmpty { - try visitor.visitSingularStringField(value: self.format, fieldNumber: 4) + if !format.isEmpty { + try visitor.visitSingularStringField(value: format, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_CompressedVideo, rhs: Foxglove_CompressedVideo) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.frameID != rhs.frameID {return false} - if lhs.data != rhs.data {return false} - if lhs.format != rhs.format {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_CompressedVideo, rhs: Foxglove_CompressedVideo) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.frameID != rhs.frameID { return false } + if lhs.data != rhs.data { return false } + if lhs.format != rhs.format { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CubePrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CubePrimitive.pb.swift index 9a9d393..4828bcb 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CubePrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CubePrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,52 +30,57 @@ struct Foxglove_CubePrimitive { /// Position of the center of the cube and orientation of the cube var pose: Foxglove_Pose { - get {return _pose ?? Foxglove_Pose()} - set {_pose = newValue} + get { _pose ?? Foxglove_Pose() } + set { _pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return self._pose != nil} + var hasPose: Bool { _pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {self._pose = nil} + mutating func clearPose() { _pose = nil } /// Size of the cube along each axis var size: Foxglove_Vector3 { - get {return _size ?? Foxglove_Vector3()} - set {_size = newValue} + get { _size ?? Foxglove_Vector3() } + set { _size = newValue } } + /// Returns true if `size` has been explicitly set. - var hasSize: Bool {return self._size != nil} + var hasSize: Bool { _size != nil } /// Clears the value of `size`. Subsequent reads from it will return its default value. - mutating func clearSize() {self._size = nil} + mutating func clearSize() { _size = nil } /// Color of the cube var color: Foxglove_Color { - get {return _color ?? Foxglove_Color()} - set {_color = newValue} + get { _color ?? Foxglove_Color() } + set { _color = newValue } } + /// Returns true if `color` has been explicitly set. - var hasColor: Bool {return self._color != nil} + var hasColor: Bool { _color != nil } /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() {self._color = nil} + mutating func clearColor() { _color = nil } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _pose: Foxglove_Pose? = nil - fileprivate var _size: Foxglove_Vector3? = nil - fileprivate var _color: Foxglove_Color? = nil + private var _pose: Foxglove_Pose? + private var _size: Foxglove_Vector3? + private var _color: Foxglove_Color? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_CubePrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_CubePrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_CubePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_CubePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".CubePrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -83,28 +88,28 @@ extension Foxglove_CubePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI 3: .same(proto: "color"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._size) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._color) }() + case 1: try decoder.decodeSingularMessageField(value: &_pose) + case 2: try decoder.decodeSingularMessageField(value: &_size) + case 3: try decoder.decodeSingularMessageField(value: &_color) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._pose { + if let v = _pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() + } try { if let v = self._size { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() @@ -114,11 +119,11 @@ extension Foxglove_CubePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_CubePrimitive, rhs: Foxglove_CubePrimitive) -> Bool { - if lhs._pose != rhs._pose {return false} - if lhs._size != rhs._size {return false} - if lhs._color != rhs._color {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_CubePrimitive, rhs: Foxglove_CubePrimitive) -> Bool { + if lhs._pose != rhs._pose { return false } + if lhs._size != rhs._size { return false } + if lhs._color != rhs._color { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CylinderPrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CylinderPrimitive.pb.swift index da5ab0a..fd57fde 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CylinderPrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CylinderPrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -28,25 +28,28 @@ struct Foxglove_CylinderPrimitive { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - /// Position of the center of the cylinder and orientation of the cylinder. The flat face(s) are perpendicular to the z-axis. + /// Position of the center of the cylinder and orientation of the cylinder. The flat face(s) are perpendicular to the + /// z-axis. var pose: Foxglove_Pose { - get {return _pose ?? Foxglove_Pose()} - set {_pose = newValue} + get { _pose ?? Foxglove_Pose() } + set { _pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return self._pose != nil} + var hasPose: Bool { _pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {self._pose = nil} + mutating func clearPose() { _pose = nil } /// Size of the cylinder's bounding box var size: Foxglove_Vector3 { - get {return _size ?? Foxglove_Vector3()} - set {_size = newValue} + get { _size ?? Foxglove_Vector3() } + set { _size = newValue } } + /// Returns true if `size` has been explicitly set. - var hasSize: Bool {return self._size != nil} + var hasSize: Bool { _size != nil } /// Clears the value of `size`. Subsequent reads from it will return its default value. - mutating func clearSize() {self._size = nil} + mutating func clearSize() { _size = nil } /// 0-1, ratio of the diameter of the cylinder's bottom face (min z) to the bottom of the bounding box var bottomScale: Double = 0 @@ -56,32 +59,35 @@ struct Foxglove_CylinderPrimitive { /// Color of the cylinder var color: Foxglove_Color { - get {return _color ?? Foxglove_Color()} - set {_color = newValue} + get { _color ?? Foxglove_Color() } + set { _color = newValue } } + /// Returns true if `color` has been explicitly set. - var hasColor: Bool {return self._color != nil} + var hasColor: Bool { _color != nil } /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() {self._color = nil} + mutating func clearColor() { _color = nil } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _pose: Foxglove_Pose? = nil - fileprivate var _size: Foxglove_Vector3? = nil - fileprivate var _color: Foxglove_Color? = nil + private var _pose: Foxglove_Pose? + private var _size: Foxglove_Vector3? + private var _color: Foxglove_Color? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_CylinderPrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_CylinderPrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_CylinderPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_CylinderPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".CylinderPrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -91,38 +97,38 @@ extension Foxglove_CylinderPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Mess 5: .same(proto: "color"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._size) }() - case 3: try { try decoder.decodeSingularDoubleField(value: &self.bottomScale) }() - case 4: try { try decoder.decodeSingularDoubleField(value: &self.topScale) }() - case 5: try { try decoder.decodeSingularMessageField(value: &self._color) }() + case 1: try decoder.decodeSingularMessageField(value: &_pose) + case 2: try decoder.decodeSingularMessageField(value: &_size) + case 3: try decoder.decodeSingularDoubleField(value: &bottomScale) + case 4: try decoder.decodeSingularDoubleField(value: &topScale) + case 5: try decoder.decodeSingularMessageField(value: &_color) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._pose { + if let v = _pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() + } try { if let v = self._size { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() - if self.bottomScale != 0 { - try visitor.visitSingularDoubleField(value: self.bottomScale, fieldNumber: 3) + if bottomScale != 0 { + try visitor.visitSingularDoubleField(value: bottomScale, fieldNumber: 3) } - if self.topScale != 0 { - try visitor.visitSingularDoubleField(value: self.topScale, fieldNumber: 4) + if topScale != 0 { + try visitor.visitSingularDoubleField(value: topScale, fieldNumber: 4) } try { if let v = self._color { try visitor.visitSingularMessageField(value: v, fieldNumber: 5) @@ -130,13 +136,13 @@ extension Foxglove_CylinderPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Mess try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_CylinderPrimitive, rhs: Foxglove_CylinderPrimitive) -> Bool { - if lhs._pose != rhs._pose {return false} - if lhs._size != rhs._size {return false} - if lhs.bottomScale != rhs.bottomScale {return false} - if lhs.topScale != rhs.topScale {return false} - if lhs._color != rhs._color {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_CylinderPrimitive, rhs: Foxglove_CylinderPrimitive) -> Bool { + if lhs._pose != rhs._pose { return false } + if lhs._size != rhs._size { return false } + if lhs.bottomScale != rhs.bottomScale { return false } + if lhs.topScale != rhs.topScale { return false } + if lhs._color != rhs._color { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/FrameTransform.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/FrameTransform.pb.swift index 6b212ca..a0e3cb6 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/FrameTransform.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/FrameTransform.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,58 +30,63 @@ struct Foxglove_FrameTransform { /// Timestamp of transform var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Name of the parent frame - var parentFrameID: String = String() + var parentFrameID: String = .init() /// Name of the child frame - var childFrameID: String = String() + var childFrameID: String = .init() /// Translation component of the transform var translation: Foxglove_Vector3 { - get {return _translation ?? Foxglove_Vector3()} - set {_translation = newValue} + get { _translation ?? Foxglove_Vector3() } + set { _translation = newValue } } + /// Returns true if `translation` has been explicitly set. - var hasTranslation: Bool {return self._translation != nil} + var hasTranslation: Bool { _translation != nil } /// Clears the value of `translation`. Subsequent reads from it will return its default value. - mutating func clearTranslation() {self._translation = nil} + mutating func clearTranslation() { _translation = nil } /// Rotation component of the transform var rotation: Foxglove_Quaternion { - get {return _rotation ?? Foxglove_Quaternion()} - set {_rotation = newValue} + get { _rotation ?? Foxglove_Quaternion() } + set { _rotation = newValue } } + /// Returns true if `rotation` has been explicitly set. - var hasRotation: Bool {return self._rotation != nil} + var hasRotation: Bool { _rotation != nil } /// Clears the value of `rotation`. Subsequent reads from it will return its default value. - mutating func clearRotation() {self._rotation = nil} + mutating func clearRotation() { _rotation = nil } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _translation: Foxglove_Vector3? = nil - fileprivate var _rotation: Foxglove_Quaternion? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + private var _translation: Foxglove_Vector3? + private var _rotation: Foxglove_Quaternion? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_FrameTransform: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_FrameTransform: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_FrameTransform: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_FrameTransform: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".FrameTransform" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -91,35 +96,35 @@ extension Foxglove_FrameTransform: SwiftProtobuf.Message, SwiftProtobuf._Message 5: .same(proto: "rotation"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.parentFrameID) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.childFrameID) }() - case 4: try { try decoder.decodeSingularMessageField(value: &self._translation) }() - case 5: try { try decoder.decodeSingularMessageField(value: &self._rotation) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularStringField(value: &parentFrameID) + case 3: try decoder.decodeSingularStringField(value: &childFrameID) + case 4: try decoder.decodeSingularMessageField(value: &_translation) + case 5: try decoder.decodeSingularMessageField(value: &_rotation) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.parentFrameID.isEmpty { - try visitor.visitSingularStringField(value: self.parentFrameID, fieldNumber: 2) } - if !self.childFrameID.isEmpty { - try visitor.visitSingularStringField(value: self.childFrameID, fieldNumber: 3) + if !parentFrameID.isEmpty { + try visitor.visitSingularStringField(value: parentFrameID, fieldNumber: 2) + } + if !childFrameID.isEmpty { + try visitor.visitSingularStringField(value: childFrameID, fieldNumber: 3) } try { if let v = self._translation { try visitor.visitSingularMessageField(value: v, fieldNumber: 4) @@ -130,13 +135,13 @@ extension Foxglove_FrameTransform: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_FrameTransform, rhs: Foxglove_FrameTransform) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.parentFrameID != rhs.parentFrameID {return false} - if lhs.childFrameID != rhs.childFrameID {return false} - if lhs._translation != rhs._translation {return false} - if lhs._rotation != rhs._rotation {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_FrameTransform, rhs: Foxglove_FrameTransform) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.parentFrameID != rhs.parentFrameID { return false } + if lhs.childFrameID != rhs.childFrameID { return false } + if lhs._translation != rhs._translation { return false } + if lhs._rotation != rhs._rotation { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/FrameTransforms.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/FrameTransforms.pb.swift index 43535d5..c5a6964 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/FrameTransforms.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/FrameTransforms.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -37,41 +37,43 @@ struct Foxglove_FrameTransforms { } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_FrameTransforms: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_FrameTransforms: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_FrameTransforms: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_FrameTransforms: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".FrameTransforms" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "transforms"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.transforms) }() + case 1: try decoder.decodeRepeatedMessageField(value: &transforms) default: break } } } - func traverse(visitor: inout V) throws { - if !self.transforms.isEmpty { - try visitor.visitRepeatedMessageField(value: self.transforms, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if !transforms.isEmpty { + try visitor.visitRepeatedMessageField(value: transforms, fieldNumber: 1) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_FrameTransforms, rhs: Foxglove_FrameTransforms) -> Bool { - if lhs.transforms != rhs.transforms {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_FrameTransforms, rhs: Foxglove_FrameTransforms) -> Bool { + if lhs.transforms != rhs.transforms { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/GeoJSON.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/GeoJSON.pb.swift index 291be86..e97ec3b 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/GeoJSON.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/GeoJSON.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -29,7 +29,7 @@ struct Foxglove_GeoJSON { // methods supported on all messages. /// GeoJSON data encoded as a UTF-8 string - var geojson: String = String() + var geojson: String = .init() var unknownFields = SwiftProtobuf.UnknownStorage() @@ -37,41 +37,43 @@ struct Foxglove_GeoJSON { } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_GeoJSON: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_GeoJSON: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_GeoJSON: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_GeoJSON: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".GeoJSON" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "geojson"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.geojson) }() + case 1: try decoder.decodeSingularStringField(value: &geojson) default: break } } } - func traverse(visitor: inout V) throws { - if !self.geojson.isEmpty { - try visitor.visitSingularStringField(value: self.geojson, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if !geojson.isEmpty { + try visitor.visitSingularStringField(value: geojson, fieldNumber: 1) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_GeoJSON, rhs: Foxglove_GeoJSON) -> Bool { - if lhs.geojson != rhs.geojson {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_GeoJSON, rhs: Foxglove_GeoJSON) -> Bool { + if lhs.geojson != rhs.geojson { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Grid.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Grid.pb.swift index 1167dde..07ffa83 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Grid.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Grid.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,86 +30,92 @@ struct Foxglove_Grid { /// Timestamp of grid var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _storage._timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_uniqueStorage()._timestamp = newValue} + get { _storage._timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _uniqueStorage()._timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return _storage._timestamp != nil} + var hasTimestamp: Bool { _storage._timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {_uniqueStorage()._timestamp = nil} + mutating func clearTimestamp() { _uniqueStorage()._timestamp = nil } /// Frame of reference var frameID: String { - get {return _storage._frameID} - set {_uniqueStorage()._frameID = newValue} + get { _storage._frameID } + set { _uniqueStorage()._frameID = newValue } } - /// Origin of grid's corner relative to frame of reference; grid is positioned in the x-y plane relative to this origin + /// Origin of grid's corner relative to frame of reference; grid is positioned in the x-y plane relative to this + /// origin var pose: Foxglove_Pose { - get {return _storage._pose ?? Foxglove_Pose()} - set {_uniqueStorage()._pose = newValue} + get { _storage._pose ?? Foxglove_Pose() } + set { _uniqueStorage()._pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return _storage._pose != nil} + var hasPose: Bool { _storage._pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {_uniqueStorage()._pose = nil} + mutating func clearPose() { _uniqueStorage()._pose = nil } /// Number of grid columns var columnCount: UInt32 { - get {return _storage._columnCount} - set {_uniqueStorage()._columnCount = newValue} + get { _storage._columnCount } + set { _uniqueStorage()._columnCount = newValue } } /// Size of single grid cell along x and y axes, relative to `pose` var cellSize: Foxglove_Vector2 { - get {return _storage._cellSize ?? Foxglove_Vector2()} - set {_uniqueStorage()._cellSize = newValue} + get { _storage._cellSize ?? Foxglove_Vector2() } + set { _uniqueStorage()._cellSize = newValue } } + /// Returns true if `cellSize` has been explicitly set. - var hasCellSize: Bool {return _storage._cellSize != nil} + var hasCellSize: Bool { _storage._cellSize != nil } /// Clears the value of `cellSize`. Subsequent reads from it will return its default value. - mutating func clearCellSize() {_uniqueStorage()._cellSize = nil} + mutating func clearCellSize() { _uniqueStorage()._cellSize = nil } /// Number of bytes between rows in `data` var rowStride: UInt32 { - get {return _storage._rowStride} - set {_uniqueStorage()._rowStride = newValue} + get { _storage._rowStride } + set { _uniqueStorage()._rowStride = newValue } } /// Number of bytes between cells within a row in `data` var cellStride: UInt32 { - get {return _storage._cellStride} - set {_uniqueStorage()._cellStride = newValue} + get { _storage._cellStride } + set { _uniqueStorage()._cellStride = newValue } } /// Fields in `data`. `red`, `green`, `blue`, and `alpha` are optional for customizing the grid's color. var fields: [Foxglove_PackedElementField] { - get {return _storage._fields} - set {_uniqueStorage()._fields = newValue} + get { _storage._fields } + set { _uniqueStorage()._fields = newValue } } /// Grid cell data, interpreted using `fields`, in row-major (y-major) order var data: Data { - get {return _storage._data} - set {_uniqueStorage()._data = newValue} + get { _storage._data } + set { _uniqueStorage()._data = newValue } } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _storage = _StorageClass.defaultInstance + private var _storage = _StorageClass.defaultInstance } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_Grid: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_Grid: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".Grid" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -124,15 +130,15 @@ extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa ] fileprivate class _StorageClass { - var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - var _frameID: String = String() - var _pose: Foxglove_Pose? = nil + var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + var _frameID: String = .init() + var _pose: Foxglove_Pose? var _columnCount: UInt32 = 0 - var _cellSize: Foxglove_Vector2? = nil + var _cellSize: Foxglove_Vector2? var _rowStride: UInt32 = 0 var _cellStride: UInt32 = 0 var _fields: [Foxglove_PackedElementField] = [] - var _data: Data = Data() + var _data: Data = .init() static let defaultInstance = _StorageClass() @@ -158,7 +164,7 @@ extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa return _storage } - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -166,22 +172,22 @@ extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &_storage._timestamp) }() - case 2: try { try decoder.decodeSingularStringField(value: &_storage._frameID) }() - case 3: try { try decoder.decodeSingularMessageField(value: &_storage._pose) }() - case 4: try { try decoder.decodeSingularFixed32Field(value: &_storage._columnCount) }() - case 5: try { try decoder.decodeSingularMessageField(value: &_storage._cellSize) }() - case 6: try { try decoder.decodeSingularFixed32Field(value: &_storage._rowStride) }() - case 7: try { try decoder.decodeSingularFixed32Field(value: &_storage._cellStride) }() - case 8: try { try decoder.decodeRepeatedMessageField(value: &_storage._fields) }() - case 9: try { try decoder.decodeSingularBytesField(value: &_storage._data) }() + case 1: try decoder.decodeSingularMessageField(value: &_storage._timestamp) + case 2: try decoder.decodeSingularStringField(value: &_storage._frameID) + case 3: try decoder.decodeSingularMessageField(value: &_storage._pose) + case 4: try decoder.decodeSingularFixed32Field(value: &_storage._columnCount) + case 5: try decoder.decodeSingularMessageField(value: &_storage._cellSize) + case 6: try decoder.decodeSingularFixed32Field(value: &_storage._rowStride) + case 7: try decoder.decodeSingularFixed32Field(value: &_storage._cellStride) + case 8: try decoder.decodeRepeatedMessageField(value: &_storage._fields) + case 9: try decoder.decodeSingularBytesField(value: &_storage._data) default: break } } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { try withExtendedLifetime(_storage) { (_storage: _StorageClass) in // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations @@ -218,25 +224,28 @@ extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_Grid, rhs: Foxglove_Grid) -> Bool { + static func == (lhs: Foxglove_Grid, rhs: Foxglove_Grid) -> Bool { if lhs._storage !== rhs._storage { - let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let storagesAreEqual: Bool = withExtendedLifetime(( + lhs._storage, + rhs._storage + )) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 let rhs_storage = _args.1 - if _storage._timestamp != rhs_storage._timestamp {return false} - if _storage._frameID != rhs_storage._frameID {return false} - if _storage._pose != rhs_storage._pose {return false} - if _storage._columnCount != rhs_storage._columnCount {return false} - if _storage._cellSize != rhs_storage._cellSize {return false} - if _storage._rowStride != rhs_storage._rowStride {return false} - if _storage._cellStride != rhs_storage._cellStride {return false} - if _storage._fields != rhs_storage._fields {return false} - if _storage._data != rhs_storage._data {return false} + if _storage._timestamp != rhs_storage._timestamp { return false } + if _storage._frameID != rhs_storage._frameID { return false } + if _storage._pose != rhs_storage._pose { return false } + if _storage._columnCount != rhs_storage._columnCount { return false } + if _storage._cellSize != rhs_storage._cellSize { return false } + if _storage._rowStride != rhs_storage._rowStride { return false } + if _storage._cellStride != rhs_storage._cellStride { return false } + if _storage._fields != rhs_storage._fields { return false } + if _storage._data != rhs_storage._data { return false } return true } - if !storagesAreEqual {return false} + if !storagesAreEqual { return false } } - if lhs.unknownFields != rhs.unknownFields {return false} + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/ImageAnnotations.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/ImageAnnotations.pb.swift index c5c9d7e..4527e23 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/ImageAnnotations.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/ImageAnnotations.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -43,14 +43,16 @@ struct Foxglove_ImageAnnotations { } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_ImageAnnotations: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_ImageAnnotations: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_ImageAnnotations: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_ImageAnnotations: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".ImageAnnotations" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "circles"), @@ -58,38 +60,38 @@ extension Foxglove_ImageAnnotations: SwiftProtobuf.Message, SwiftProtobuf._Messa 3: .same(proto: "texts"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.circles) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.points) }() - case 3: try { try decoder.decodeRepeatedMessageField(value: &self.texts) }() + case 1: try decoder.decodeRepeatedMessageField(value: &circles) + case 2: try decoder.decodeRepeatedMessageField(value: &points) + case 3: try decoder.decodeRepeatedMessageField(value: &texts) default: break } } } - func traverse(visitor: inout V) throws { - if !self.circles.isEmpty { - try visitor.visitRepeatedMessageField(value: self.circles, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if !circles.isEmpty { + try visitor.visitRepeatedMessageField(value: circles, fieldNumber: 1) } - if !self.points.isEmpty { - try visitor.visitRepeatedMessageField(value: self.points, fieldNumber: 2) + if !points.isEmpty { + try visitor.visitRepeatedMessageField(value: points, fieldNumber: 2) } - if !self.texts.isEmpty { - try visitor.visitRepeatedMessageField(value: self.texts, fieldNumber: 3) + if !texts.isEmpty { + try visitor.visitRepeatedMessageField(value: texts, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_ImageAnnotations, rhs: Foxglove_ImageAnnotations) -> Bool { - if lhs.circles != rhs.circles {return false} - if lhs.points != rhs.points {return false} - if lhs.texts != rhs.texts {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_ImageAnnotations, rhs: Foxglove_ImageAnnotations) -> Bool { + if lhs.circles != rhs.circles { return false } + if lhs.points != rhs.points { return false } + if lhs.texts != rhs.texts { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/KeyValuePair.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/KeyValuePair.pb.swift index 2497e56..e3b450d 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/KeyValuePair.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/KeyValuePair.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -29,10 +29,10 @@ struct Foxglove_KeyValuePair { // methods supported on all messages. /// Key - var key: String = String() + var key: String = .init() /// Value - var value: String = String() + var value: String = .init() var unknownFields = SwiftProtobuf.UnknownStorage() @@ -40,47 +40,49 @@ struct Foxglove_KeyValuePair { } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_KeyValuePair: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_KeyValuePair: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_KeyValuePair: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_KeyValuePair: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".KeyValuePair" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "key"), 2: .same(proto: "value"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.key) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.value) }() + case 1: try decoder.decodeSingularStringField(value: &key) + case 2: try decoder.decodeSingularStringField(value: &value) default: break } } } - func traverse(visitor: inout V) throws { - if !self.key.isEmpty { - try visitor.visitSingularStringField(value: self.key, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if !key.isEmpty { + try visitor.visitSingularStringField(value: key, fieldNumber: 1) } - if !self.value.isEmpty { - try visitor.visitSingularStringField(value: self.value, fieldNumber: 2) + if !value.isEmpty { + try visitor.visitSingularStringField(value: value, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_KeyValuePair, rhs: Foxglove_KeyValuePair) -> Bool { - if lhs.key != rhs.key {return false} - if lhs.value != rhs.value {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_KeyValuePair, rhs: Foxglove_KeyValuePair) -> Bool { + if lhs.key != rhs.key { return false } + if lhs.value != rhs.value { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/LaserScan.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/LaserScan.pb.swift index 24b1a8c..f017da3 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/LaserScan.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/LaserScan.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,26 +30,29 @@ struct Foxglove_LaserScan { /// Timestamp of scan var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Frame of reference - var frameID: String = String() + var frameID: String = .init() - /// Origin of scan relative to frame of reference; points are positioned in the x-y plane relative to this origin; angles are interpreted as counterclockwise rotations around the z axis with 0 rad being in the +x direction + /// Origin of scan relative to frame of reference; points are positioned in the x-y plane relative to this origin; + /// angles are interpreted as counterclockwise rotations around the z axis with 0 rad being in the +x direction var pose: Foxglove_Pose { - get {return _pose ?? Foxglove_Pose()} - set {_pose = newValue} + get { _pose ?? Foxglove_Pose() } + set { _pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return self._pose != nil} + var hasPose: Bool { _pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {self._pose = nil} + mutating func clearPose() { _pose = nil } /// Bearing of first point, in radians var startAngle: Double = 0 @@ -67,19 +70,21 @@ struct Foxglove_LaserScan { init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _pose: Foxglove_Pose? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + private var _pose: Foxglove_Pose? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_LaserScan: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_LaserScan: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_LaserScan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_LaserScan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".LaserScan" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -91,62 +96,62 @@ extension Foxglove_LaserScan: SwiftProtobuf.Message, SwiftProtobuf._MessageImple 7: .same(proto: "intensities"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._pose) }() - case 4: try { try decoder.decodeSingularDoubleField(value: &self.startAngle) }() - case 5: try { try decoder.decodeSingularDoubleField(value: &self.endAngle) }() - case 6: try { try decoder.decodeRepeatedDoubleField(value: &self.ranges) }() - case 7: try { try decoder.decodeRepeatedDoubleField(value: &self.intensities) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularStringField(value: &frameID) + case 3: try decoder.decodeSingularMessageField(value: &_pose) + case 4: try decoder.decodeSingularDoubleField(value: &startAngle) + case 5: try decoder.decodeSingularDoubleField(value: &endAngle) + case 6: try decoder.decodeRepeatedDoubleField(value: &ranges) + case 7: try decoder.decodeRepeatedDoubleField(value: &intensities) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.frameID.isEmpty { - try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) + } + if !frameID.isEmpty { + try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) } try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 3) } }() - if self.startAngle != 0 { - try visitor.visitSingularDoubleField(value: self.startAngle, fieldNumber: 4) + if startAngle != 0 { + try visitor.visitSingularDoubleField(value: startAngle, fieldNumber: 4) } - if self.endAngle != 0 { - try visitor.visitSingularDoubleField(value: self.endAngle, fieldNumber: 5) + if endAngle != 0 { + try visitor.visitSingularDoubleField(value: endAngle, fieldNumber: 5) } - if !self.ranges.isEmpty { - try visitor.visitPackedDoubleField(value: self.ranges, fieldNumber: 6) + if !ranges.isEmpty { + try visitor.visitPackedDoubleField(value: ranges, fieldNumber: 6) } - if !self.intensities.isEmpty { - try visitor.visitPackedDoubleField(value: self.intensities, fieldNumber: 7) + if !intensities.isEmpty { + try visitor.visitPackedDoubleField(value: intensities, fieldNumber: 7) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_LaserScan, rhs: Foxglove_LaserScan) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.frameID != rhs.frameID {return false} - if lhs._pose != rhs._pose {return false} - if lhs.startAngle != rhs.startAngle {return false} - if lhs.endAngle != rhs.endAngle {return false} - if lhs.ranges != rhs.ranges {return false} - if lhs.intensities != rhs.intensities {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_LaserScan, rhs: Foxglove_LaserScan) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.frameID != rhs.frameID { return false } + if lhs._pose != rhs._pose { return false } + if lhs.startAngle != rhs.startAngle { return false } + if lhs.endAngle != rhs.endAngle { return false } + if lhs.ranges != rhs.ranges { return false } + if lhs.intensities != rhs.intensities { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/LinePrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/LinePrimitive.pb.swift index fb33a3d..7cfbae0 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/LinePrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/LinePrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,60 +30,65 @@ struct Foxglove_LinePrimitive { /// Drawing primitive to use for lines var type: Foxglove_LinePrimitive.TypeEnum { - get {return _storage._type} - set {_uniqueStorage()._type = newValue} + get { _storage._type } + set { _uniqueStorage()._type = newValue } } /// Origin of lines relative to reference frame var pose: Foxglove_Pose { - get {return _storage._pose ?? Foxglove_Pose()} - set {_uniqueStorage()._pose = newValue} + get { _storage._pose ?? Foxglove_Pose() } + set { _uniqueStorage()._pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return _storage._pose != nil} + var hasPose: Bool { _storage._pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {_uniqueStorage()._pose = nil} + mutating func clearPose() { _uniqueStorage()._pose = nil } /// Line thickness var thickness: Double { - get {return _storage._thickness} - set {_uniqueStorage()._thickness = newValue} + get { _storage._thickness } + set { _uniqueStorage()._thickness = newValue } } - /// Indicates whether `thickness` is a fixed size in screen pixels (true), or specified in world coordinates and scales with distance from the camera (false) + /// Indicates whether `thickness` is a fixed size in screen pixels (true), or specified in world coordinates and + /// scales with distance from the camera (false) var scaleInvariant: Bool { - get {return _storage._scaleInvariant} - set {_uniqueStorage()._scaleInvariant = newValue} + get { _storage._scaleInvariant } + set { _uniqueStorage()._scaleInvariant = newValue } } /// Points along the line var points: [Foxglove_Point3] { - get {return _storage._points} - set {_uniqueStorage()._points = newValue} + get { _storage._points } + set { _uniqueStorage()._points = newValue } } /// Solid color to use for the whole line. One of `color` or `colors` must be provided. var color: Foxglove_Color { - get {return _storage._color ?? Foxglove_Color()} - set {_uniqueStorage()._color = newValue} + get { _storage._color ?? Foxglove_Color() } + set { _uniqueStorage()._color = newValue } } + /// Returns true if `color` has been explicitly set. - var hasColor: Bool {return _storage._color != nil} + var hasColor: Bool { _storage._color != nil } /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() {_uniqueStorage()._color = nil} + mutating func clearColor() { _uniqueStorage()._color = nil } - /// Per-point colors (if specified, must have the same length as `points`). One of `color` or `colors` must be provided. + /// Per-point colors (if specified, must have the same length as `points`). One of `color` or `colors` must be + /// provided. var colors: [Foxglove_Color] { - get {return _storage._colors} - set {_uniqueStorage()._colors = newValue} + get { _storage._colors } + set { _uniqueStorage()._colors = newValue } } /// Indices into the `points` and `colors` attribute arrays, which can be used to avoid duplicating attribute data. - /// - /// If omitted or empty, indexing will not be used. This default behavior is equivalent to specifying [0, 1, ..., N-1] for the indices (where N is the number of `points` provided). + /// + /// If omitted or empty, indexing will not be used. This default behavior is equivalent to specifying [0, 1, ..., N-1] + /// for the indices (where N is the number of `points` provided). var indices: [UInt32] { - get {return _storage._indices} - set {_uniqueStorage()._indices = newValue} + get { _storage._indices } + set { _uniqueStorage()._indices = newValue } } var unknownFields = SwiftProtobuf.UnknownStorage() @@ -117,43 +122,44 @@ struct Foxglove_LinePrimitive { var rawValue: Int { switch self { - case .lineStrip: return 0 - case .lineLoop: return 1 - case .lineList: return 2 - case .UNRECOGNIZED(let i): return i + case .lineStrip: 0 + case .lineLoop: 1 + case .lineList: 2 + case let .UNRECOGNIZED(i): i } } - } init() {} - fileprivate var _storage = _StorageClass.defaultInstance + private var _storage = _StorageClass.defaultInstance } #if swift(>=4.2) -extension Foxglove_LinePrimitive.TypeEnum: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_LinePrimitive.TypeEnum] = [ - .lineStrip, - .lineLoop, - .lineList, - ] -} + extension Foxglove_LinePrimitive.TypeEnum: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_LinePrimitive.TypeEnum] = [ + .lineStrip, + .lineLoop, + .lineList, + ] + } -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_LinePrimitive: @unchecked Sendable {} -extension Foxglove_LinePrimitive.TypeEnum: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_LinePrimitive: @unchecked Sendable {} + extension Foxglove_LinePrimitive.TypeEnum: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".LinePrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "type"), @@ -168,11 +174,11 @@ extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI fileprivate class _StorageClass { var _type: Foxglove_LinePrimitive.TypeEnum = .lineStrip - var _pose: Foxglove_Pose? = nil + var _pose: Foxglove_Pose? var _thickness: Double = 0 var _scaleInvariant: Bool = false var _points: [Foxglove_Point3] = [] - var _color: Foxglove_Color? = nil + var _color: Foxglove_Color? var _colors: [Foxglove_Color] = [] var _indices: [UInt32] = [] @@ -199,7 +205,7 @@ extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI return _storage } - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -207,21 +213,21 @@ extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularEnumField(value: &_storage._type) }() - case 2: try { try decoder.decodeSingularMessageField(value: &_storage._pose) }() - case 3: try { try decoder.decodeSingularDoubleField(value: &_storage._thickness) }() - case 4: try { try decoder.decodeSingularBoolField(value: &_storage._scaleInvariant) }() - case 5: try { try decoder.decodeRepeatedMessageField(value: &_storage._points) }() - case 6: try { try decoder.decodeSingularMessageField(value: &_storage._color) }() - case 7: try { try decoder.decodeRepeatedMessageField(value: &_storage._colors) }() - case 8: try { try decoder.decodeRepeatedFixed32Field(value: &_storage._indices) }() + case 1: try decoder.decodeSingularEnumField(value: &_storage._type) + case 2: try decoder.decodeSingularMessageField(value: &_storage._pose) + case 3: try decoder.decodeSingularDoubleField(value: &_storage._thickness) + case 4: try decoder.decodeSingularBoolField(value: &_storage._scaleInvariant) + case 5: try decoder.decodeRepeatedMessageField(value: &_storage._points) + case 6: try decoder.decodeSingularMessageField(value: &_storage._color) + case 7: try decoder.decodeRepeatedMessageField(value: &_storage._colors) + case 8: try decoder.decodeRepeatedFixed32Field(value: &_storage._indices) default: break } } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { try withExtendedLifetime(_storage) { (_storage: _StorageClass) in // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations @@ -255,24 +261,27 @@ extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_LinePrimitive, rhs: Foxglove_LinePrimitive) -> Bool { + static func == (lhs: Foxglove_LinePrimitive, rhs: Foxglove_LinePrimitive) -> Bool { if lhs._storage !== rhs._storage { - let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let storagesAreEqual: Bool = withExtendedLifetime(( + lhs._storage, + rhs._storage + )) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 let rhs_storage = _args.1 - if _storage._type != rhs_storage._type {return false} - if _storage._pose != rhs_storage._pose {return false} - if _storage._thickness != rhs_storage._thickness {return false} - if _storage._scaleInvariant != rhs_storage._scaleInvariant {return false} - if _storage._points != rhs_storage._points {return false} - if _storage._color != rhs_storage._color {return false} - if _storage._colors != rhs_storage._colors {return false} - if _storage._indices != rhs_storage._indices {return false} + if _storage._type != rhs_storage._type { return false } + if _storage._pose != rhs_storage._pose { return false } + if _storage._thickness != rhs_storage._thickness { return false } + if _storage._scaleInvariant != rhs_storage._scaleInvariant { return false } + if _storage._points != rhs_storage._points { return false } + if _storage._color != rhs_storage._color { return false } + if _storage._colors != rhs_storage._colors { return false } + if _storage._indices != rhs_storage._indices { return false } return true } - if !storagesAreEqual {return false} + if !storagesAreEqual { return false } } - if lhs.unknownFields != rhs.unknownFields {return false} + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/LocationFix.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/LocationFix.pb.swift index ca2d706..3a43dfb 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/LocationFix.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/LocationFix.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,16 +30,17 @@ struct Foxglove_LocationFix { /// Timestamp of the message var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Frame for the sensor. Latitude and longitude readings are at the origin of the frame. - var frameID: String = String() + var frameID: String = .init() /// Latitude in degrees var latitude: Double = 0 @@ -50,7 +51,8 @@ struct Foxglove_LocationFix { /// Altitude in meters var altitude: Double = 0 - /// Position covariance (m^2) defined relative to a tangential plane through the reported position. The components are East, North, and Up (ENU), in row-major order. + /// Position covariance (m^2) defined relative to a tangential plane through the reported position. The components are + /// East, North, and Up (ENU), in row-major order. var positionCovariance: [Double] = [] /// If `position_covariance` is available, `position_covariance_type` must be set to indicate the type of covariance. @@ -83,45 +85,46 @@ struct Foxglove_LocationFix { var rawValue: Int { switch self { - case .unknown: return 0 - case .approximated: return 1 - case .diagonalKnown: return 2 - case .known: return 3 - case .UNRECOGNIZED(let i): return i + case .unknown: 0 + case .approximated: 1 + case .diagonalKnown: 2 + case .known: 3 + case let .UNRECOGNIZED(i): i } } - } init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? } #if swift(>=4.2) -extension Foxglove_LocationFix.PositionCovarianceType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_LocationFix.PositionCovarianceType] = [ - .unknown, - .approximated, - .diagonalKnown, - .known, - ] -} + extension Foxglove_LocationFix.PositionCovarianceType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_LocationFix.PositionCovarianceType] = [ + .unknown, + .approximated, + .diagonalKnown, + .known, + ] + } -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_LocationFix: @unchecked Sendable {} -extension Foxglove_LocationFix.PositionCovarianceType: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_LocationFix: @unchecked Sendable {} + extension Foxglove_LocationFix.PositionCovarianceType: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_LocationFix: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_LocationFix: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".LocationFix" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 6: .same(proto: "timestamp"), @@ -133,62 +136,62 @@ extension Foxglove_LocationFix: SwiftProtobuf.Message, SwiftProtobuf._MessageImp 5: .standard(proto: "position_covariance_type"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularDoubleField(value: &self.latitude) }() - case 2: try { try decoder.decodeSingularDoubleField(value: &self.longitude) }() - case 3: try { try decoder.decodeSingularDoubleField(value: &self.altitude) }() - case 4: try { try decoder.decodeRepeatedDoubleField(value: &self.positionCovariance) }() - case 5: try { try decoder.decodeSingularEnumField(value: &self.positionCovarianceType) }() - case 6: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 7: try { try decoder.decodeSingularStringField(value: &self.frameID) }() + case 1: try decoder.decodeSingularDoubleField(value: &latitude) + case 2: try decoder.decodeSingularDoubleField(value: &longitude) + case 3: try decoder.decodeSingularDoubleField(value: &altitude) + case 4: try decoder.decodeRepeatedDoubleField(value: &positionCovariance) + case 5: try decoder.decodeSingularEnumField(value: &positionCovarianceType) + case 6: try decoder.decodeSingularMessageField(value: &_timestamp) + case 7: try decoder.decodeSingularStringField(value: &frameID) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if self.latitude != 0 { - try visitor.visitSingularDoubleField(value: self.latitude, fieldNumber: 1) + if latitude != 0 { + try visitor.visitSingularDoubleField(value: latitude, fieldNumber: 1) } - if self.longitude != 0 { - try visitor.visitSingularDoubleField(value: self.longitude, fieldNumber: 2) + if longitude != 0 { + try visitor.visitSingularDoubleField(value: longitude, fieldNumber: 2) } - if self.altitude != 0 { - try visitor.visitSingularDoubleField(value: self.altitude, fieldNumber: 3) + if altitude != 0 { + try visitor.visitSingularDoubleField(value: altitude, fieldNumber: 3) } - if !self.positionCovariance.isEmpty { - try visitor.visitPackedDoubleField(value: self.positionCovariance, fieldNumber: 4) + if !positionCovariance.isEmpty { + try visitor.visitPackedDoubleField(value: positionCovariance, fieldNumber: 4) } - if self.positionCovarianceType != .unknown { - try visitor.visitSingularEnumField(value: self.positionCovarianceType, fieldNumber: 5) + if positionCovarianceType != .unknown { + try visitor.visitSingularEnumField(value: positionCovarianceType, fieldNumber: 5) } try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 6) } }() - if !self.frameID.isEmpty { - try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 7) + if !frameID.isEmpty { + try visitor.visitSingularStringField(value: frameID, fieldNumber: 7) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_LocationFix, rhs: Foxglove_LocationFix) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.frameID != rhs.frameID {return false} - if lhs.latitude != rhs.latitude {return false} - if lhs.longitude != rhs.longitude {return false} - if lhs.altitude != rhs.altitude {return false} - if lhs.positionCovariance != rhs.positionCovariance {return false} - if lhs.positionCovarianceType != rhs.positionCovarianceType {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_LocationFix, rhs: Foxglove_LocationFix) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.frameID != rhs.frameID { return false } + if lhs.latitude != rhs.latitude { return false } + if lhs.longitude != rhs.longitude { return false } + if lhs.altitude != rhs.altitude { return false } + if lhs.positionCovariance != rhs.positionCovariance { return false } + if lhs.positionCovarianceType != rhs.positionCovarianceType { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Log.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Log.pb.swift index f6028dd..b91822e 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Log.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Log.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,25 +30,26 @@ struct Foxglove_Log { /// Timestamp of log message var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Log level var level: Foxglove_Log.Level = .unknown /// Log message - var message: String = String() + var message: String = .init() /// Process or node name - var name: String = String() + var name: String = .init() /// Filename - var file: String = String() + var file: String = .init() /// Line number in the file var line: UInt32 = 0 @@ -84,49 +85,50 @@ struct Foxglove_Log { var rawValue: Int { switch self { - case .unknown: return 0 - case .debug: return 1 - case .info: return 2 - case .warning: return 3 - case .error: return 4 - case .fatal: return 5 - case .UNRECOGNIZED(let i): return i + case .unknown: 0 + case .debug: 1 + case .info: 2 + case .warning: 3 + case .error: 4 + case .fatal: 5 + case let .UNRECOGNIZED(i): i } } - } init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? } #if swift(>=4.2) -extension Foxglove_Log.Level: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_Log.Level] = [ - .unknown, - .debug, - .info, - .warning, - .error, - .fatal, - ] -} + extension Foxglove_Log.Level: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_Log.Level] = [ + .unknown, + .debug, + .info, + .warning, + .error, + .fatal, + ] + } -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_Log: @unchecked Sendable {} -extension Foxglove_Log.Level: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_Log: @unchecked Sendable {} + extension Foxglove_Log.Level: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_Log: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_Log: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".Log" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -137,57 +139,57 @@ extension Foxglove_Log: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat 6: .same(proto: "line"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularEnumField(value: &self.level) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.message) }() - case 4: try { try decoder.decodeSingularStringField(value: &self.name) }() - case 5: try { try decoder.decodeSingularStringField(value: &self.file) }() - case 6: try { try decoder.decodeSingularFixed32Field(value: &self.line) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularEnumField(value: &level) + case 3: try decoder.decodeSingularStringField(value: &message) + case 4: try decoder.decodeSingularStringField(value: &name) + case 5: try decoder.decodeSingularStringField(value: &file) + case 6: try decoder.decodeSingularFixed32Field(value: &line) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if self.level != .unknown { - try visitor.visitSingularEnumField(value: self.level, fieldNumber: 2) } - if !self.message.isEmpty { - try visitor.visitSingularStringField(value: self.message, fieldNumber: 3) + if level != .unknown { + try visitor.visitSingularEnumField(value: level, fieldNumber: 2) + } + if !message.isEmpty { + try visitor.visitSingularStringField(value: message, fieldNumber: 3) } - if !self.name.isEmpty { - try visitor.visitSingularStringField(value: self.name, fieldNumber: 4) + if !name.isEmpty { + try visitor.visitSingularStringField(value: name, fieldNumber: 4) } - if !self.file.isEmpty { - try visitor.visitSingularStringField(value: self.file, fieldNumber: 5) + if !file.isEmpty { + try visitor.visitSingularStringField(value: file, fieldNumber: 5) } - if self.line != 0 { - try visitor.visitSingularFixed32Field(value: self.line, fieldNumber: 6) + if line != 0 { + try visitor.visitSingularFixed32Field(value: line, fieldNumber: 6) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_Log, rhs: Foxglove_Log) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.level != rhs.level {return false} - if lhs.message != rhs.message {return false} - if lhs.name != rhs.name {return false} - if lhs.file != rhs.file {return false} - if lhs.line != rhs.line {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_Log, rhs: Foxglove_Log) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.level != rhs.level { return false } + if lhs.message != rhs.message { return false } + if lhs.name != rhs.name { return false } + if lhs.file != rhs.file { return false } + if lhs.line != rhs.line { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/ModelPrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/ModelPrimitive.pb.swift index e5f9f57..92bb425 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/ModelPrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/ModelPrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,74 +30,82 @@ struct Foxglove_ModelPrimitive { /// Origin of model relative to reference frame var pose: Foxglove_Pose { - get {return _storage._pose ?? Foxglove_Pose()} - set {_uniqueStorage()._pose = newValue} + get { _storage._pose ?? Foxglove_Pose() } + set { _uniqueStorage()._pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return _storage._pose != nil} + var hasPose: Bool { _storage._pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {_uniqueStorage()._pose = nil} + mutating func clearPose() { _uniqueStorage()._pose = nil } /// Scale factor to apply to the model along each axis var scale: Foxglove_Vector3 { - get {return _storage._scale ?? Foxglove_Vector3()} - set {_uniqueStorage()._scale = newValue} + get { _storage._scale ?? Foxglove_Vector3() } + set { _uniqueStorage()._scale = newValue } } + /// Returns true if `scale` has been explicitly set. - var hasScale: Bool {return _storage._scale != nil} + var hasScale: Bool { _storage._scale != nil } /// Clears the value of `scale`. Subsequent reads from it will return its default value. - mutating func clearScale() {_uniqueStorage()._scale = nil} + mutating func clearScale() { _uniqueStorage()._scale = nil } /// Solid color to use for the whole model if `override_color` is true. var color: Foxglove_Color { - get {return _storage._color ?? Foxglove_Color()} - set {_uniqueStorage()._color = newValue} + get { _storage._color ?? Foxglove_Color() } + set { _uniqueStorage()._color = newValue } } + /// Returns true if `color` has been explicitly set. - var hasColor: Bool {return _storage._color != nil} + var hasColor: Bool { _storage._color != nil } /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() {_uniqueStorage()._color = nil} + mutating func clearColor() { _uniqueStorage()._color = nil } /// Whether to use the color specified in `color` instead of any materials embedded in the original model. var overrideColor: Bool { - get {return _storage._overrideColor} - set {_uniqueStorage()._overrideColor = newValue} + get { _storage._overrideColor } + set { _uniqueStorage()._overrideColor = newValue } } /// URL pointing to model file. One of `url` or `data` should be provided. var url: String { - get {return _storage._url} - set {_uniqueStorage()._url = newValue} + get { _storage._url } + set { _uniqueStorage()._url = newValue } } - /// [Media type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of embedded model (e.g. `model/gltf-binary`). Required if `data` is provided instead of `url`. Overrides the inferred media type if `url` is provided. + /// [Media type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of embedded model (e.g. + /// `model/gltf-binary`). Required if `data` is provided instead of `url`. Overrides the inferred media type if `url` + /// is provided. var mediaType: String { - get {return _storage._mediaType} - set {_uniqueStorage()._mediaType = newValue} + get { _storage._mediaType } + set { _uniqueStorage()._mediaType = newValue } } - /// Embedded model. One of `url` or `data` should be provided. If `data` is provided, `media_type` must be set to indicate the type of the data. + /// Embedded model. One of `url` or `data` should be provided. If `data` is provided, `media_type` must be set to + /// indicate the type of the data. var data: Data { - get {return _storage._data} - set {_uniqueStorage()._data = newValue} + get { _storage._data } + set { _uniqueStorage()._data = newValue } } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _storage = _StorageClass.defaultInstance + private var _storage = _StorageClass.defaultInstance } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_ModelPrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_ModelPrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".ModelPrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -110,13 +118,13 @@ extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message ] fileprivate class _StorageClass { - var _pose: Foxglove_Pose? = nil - var _scale: Foxglove_Vector3? = nil - var _color: Foxglove_Color? = nil + var _pose: Foxglove_Pose? + var _scale: Foxglove_Vector3? + var _color: Foxglove_Color? var _overrideColor: Bool = false - var _url: String = String() - var _mediaType: String = String() - var _data: Data = Data() + var _url: String = .init() + var _mediaType: String = .init() + var _data: Data = .init() static let defaultInstance = _StorageClass() @@ -140,7 +148,7 @@ extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message return _storage } - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -148,20 +156,20 @@ extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &_storage._pose) }() - case 2: try { try decoder.decodeSingularMessageField(value: &_storage._scale) }() - case 3: try { try decoder.decodeSingularMessageField(value: &_storage._color) }() - case 4: try { try decoder.decodeSingularBoolField(value: &_storage._overrideColor) }() - case 5: try { try decoder.decodeSingularStringField(value: &_storage._url) }() - case 6: try { try decoder.decodeSingularStringField(value: &_storage._mediaType) }() - case 7: try { try decoder.decodeSingularBytesField(value: &_storage._data) }() + case 1: try decoder.decodeSingularMessageField(value: &_storage._pose) + case 2: try decoder.decodeSingularMessageField(value: &_storage._scale) + case 3: try decoder.decodeSingularMessageField(value: &_storage._color) + case 4: try decoder.decodeSingularBoolField(value: &_storage._overrideColor) + case 5: try decoder.decodeSingularStringField(value: &_storage._url) + case 6: try decoder.decodeSingularStringField(value: &_storage._mediaType) + case 7: try decoder.decodeSingularBytesField(value: &_storage._data) default: break } } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { try withExtendedLifetime(_storage) { (_storage: _StorageClass) in // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations @@ -192,23 +200,26 @@ extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_ModelPrimitive, rhs: Foxglove_ModelPrimitive) -> Bool { + static func == (lhs: Foxglove_ModelPrimitive, rhs: Foxglove_ModelPrimitive) -> Bool { if lhs._storage !== rhs._storage { - let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let storagesAreEqual: Bool = withExtendedLifetime(( + lhs._storage, + rhs._storage + )) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 let rhs_storage = _args.1 - if _storage._pose != rhs_storage._pose {return false} - if _storage._scale != rhs_storage._scale {return false} - if _storage._color != rhs_storage._color {return false} - if _storage._overrideColor != rhs_storage._overrideColor {return false} - if _storage._url != rhs_storage._url {return false} - if _storage._mediaType != rhs_storage._mediaType {return false} - if _storage._data != rhs_storage._data {return false} + if _storage._pose != rhs_storage._pose { return false } + if _storage._scale != rhs_storage._scale { return false } + if _storage._color != rhs_storage._color { return false } + if _storage._overrideColor != rhs_storage._overrideColor { return false } + if _storage._url != rhs_storage._url { return false } + if _storage._mediaType != rhs_storage._mediaType { return false } + if _storage._data != rhs_storage._data { return false } return true } - if !storagesAreEqual {return false} + if !storagesAreEqual { return false } } - if lhs.unknownFields != rhs.unknownFields {return false} + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/PackedElementField.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/PackedElementField.pb.swift index 201a33c..924aa61 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/PackedElementField.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/PackedElementField.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -29,7 +29,7 @@ struct Foxglove_PackedElementField { // methods supported on all messages. /// Name of the field - var name: String = String() + var name: String = .init() /// Byte offset from start of data buffer var offset: UInt32 = 0 @@ -74,19 +74,18 @@ struct Foxglove_PackedElementField { var rawValue: Int { switch self { - case .unknown: return 0 - case .uint8: return 1 - case .int8: return 2 - case .uint16: return 3 - case .int16: return 4 - case .uint32: return 5 - case .int32: return 6 - case .float32: return 7 - case .float64: return 8 - case .UNRECOGNIZED(let i): return i + case .unknown: 0 + case .uint8: 1 + case .int8: 2 + case .uint16: 3 + case .int16: 4 + case .uint32: 5 + case .int32: 6 + case .float32: 7 + case .float64: 8 + case let .UNRECOGNIZED(i): i } } - } init() {} @@ -94,33 +93,35 @@ struct Foxglove_PackedElementField { #if swift(>=4.2) -extension Foxglove_PackedElementField.NumericType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_PackedElementField.NumericType] = [ - .unknown, - .uint8, - .int8, - .uint16, - .int16, - .uint32, - .int32, - .float32, - .float64, - ] -} + extension Foxglove_PackedElementField.NumericType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_PackedElementField.NumericType] = [ + .unknown, + .uint8, + .int8, + .uint16, + .int16, + .uint32, + .int32, + .float32, + .float64, + ] + } -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_PackedElementField: @unchecked Sendable {} -extension Foxglove_PackedElementField.NumericType: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_PackedElementField: @unchecked Sendable {} + extension Foxglove_PackedElementField.NumericType: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_PackedElementField: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_PackedElementField: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".PackedElementField" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "name"), @@ -128,38 +129,38 @@ extension Foxglove_PackedElementField: SwiftProtobuf.Message, SwiftProtobuf._Mes 3: .same(proto: "type"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() - case 2: try { try decoder.decodeSingularFixed32Field(value: &self.offset) }() - case 3: try { try decoder.decodeSingularEnumField(value: &self.type) }() + case 1: try decoder.decodeSingularStringField(value: &name) + case 2: try decoder.decodeSingularFixed32Field(value: &offset) + case 3: try decoder.decodeSingularEnumField(value: &type) default: break } } } - func traverse(visitor: inout V) throws { - if !self.name.isEmpty { - try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if !name.isEmpty { + try visitor.visitSingularStringField(value: name, fieldNumber: 1) } - if self.offset != 0 { - try visitor.visitSingularFixed32Field(value: self.offset, fieldNumber: 2) + if offset != 0 { + try visitor.visitSingularFixed32Field(value: offset, fieldNumber: 2) } - if self.type != .unknown { - try visitor.visitSingularEnumField(value: self.type, fieldNumber: 3) + if type != .unknown { + try visitor.visitSingularEnumField(value: type, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_PackedElementField, rhs: Foxglove_PackedElementField) -> Bool { - if lhs.name != rhs.name {return false} - if lhs.offset != rhs.offset {return false} - if lhs.type != rhs.type {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_PackedElementField, rhs: Foxglove_PackedElementField) -> Bool { + if lhs.name != rhs.name { return false } + if lhs.offset != rhs.offset { return false } + if lhs.type != rhs.type { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Point2.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Point2.pb.swift index fdc2b6d..9dfe69a 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Point2.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Point2.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -40,47 +40,49 @@ struct Foxglove_Point2 { } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_Point2: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_Point2: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_Point2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_Point2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".Point2" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "x"), 2: .same(proto: "y"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularDoubleField(value: &self.x) }() - case 2: try { try decoder.decodeSingularDoubleField(value: &self.y) }() + case 1: try decoder.decodeSingularDoubleField(value: &x) + case 2: try decoder.decodeSingularDoubleField(value: &y) default: break } } } - func traverse(visitor: inout V) throws { - if self.x != 0 { - try visitor.visitSingularDoubleField(value: self.x, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if x != 0 { + try visitor.visitSingularDoubleField(value: x, fieldNumber: 1) } - if self.y != 0 { - try visitor.visitSingularDoubleField(value: self.y, fieldNumber: 2) + if y != 0 { + try visitor.visitSingularDoubleField(value: y, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_Point2, rhs: Foxglove_Point2) -> Bool { - if lhs.x != rhs.x {return false} - if lhs.y != rhs.y {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_Point2, rhs: Foxglove_Point2) -> Bool { + if lhs.x != rhs.x { return false } + if lhs.y != rhs.y { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Point3.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Point3.pb.swift index e8759a4..47a6000 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Point3.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Point3.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -43,14 +43,16 @@ struct Foxglove_Point3 { } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_Point3: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_Point3: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_Point3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_Point3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".Point3" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "x"), @@ -58,38 +60,38 @@ extension Foxglove_Point3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen 3: .same(proto: "z"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularDoubleField(value: &self.x) }() - case 2: try { try decoder.decodeSingularDoubleField(value: &self.y) }() - case 3: try { try decoder.decodeSingularDoubleField(value: &self.z) }() + case 1: try decoder.decodeSingularDoubleField(value: &x) + case 2: try decoder.decodeSingularDoubleField(value: &y) + case 3: try decoder.decodeSingularDoubleField(value: &z) default: break } } } - func traverse(visitor: inout V) throws { - if self.x != 0 { - try visitor.visitSingularDoubleField(value: self.x, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if x != 0 { + try visitor.visitSingularDoubleField(value: x, fieldNumber: 1) } - if self.y != 0 { - try visitor.visitSingularDoubleField(value: self.y, fieldNumber: 2) + if y != 0 { + try visitor.visitSingularDoubleField(value: y, fieldNumber: 2) } - if self.z != 0 { - try visitor.visitSingularDoubleField(value: self.z, fieldNumber: 3) + if z != 0 { + try visitor.visitSingularDoubleField(value: z, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_Point3, rhs: Foxglove_Point3) -> Bool { - if lhs.x != rhs.x {return false} - if lhs.y != rhs.y {return false} - if lhs.z != rhs.z {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_Point3, rhs: Foxglove_Point3) -> Bool { + if lhs.x != rhs.x { return false } + if lhs.y != rhs.y { return false } + if lhs.z != rhs.z { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/PointCloud.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/PointCloud.pb.swift index be209f0..608b0f7 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/PointCloud.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/PointCloud.pb.swift @@ -17,12 +17,13 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } -/// A collection of N-dimensional points, which may contain additional fields with information like normals, intensity, etc. +/// A collection of N-dimensional points, which may contain additional fields with information like normals, intensity, +/// etc. struct Foxglove_PointCloud { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -30,53 +31,58 @@ struct Foxglove_PointCloud { /// Timestamp of point cloud var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Frame of reference - var frameID: String = String() + var frameID: String = .init() /// The origin of the point cloud relative to the frame of reference var pose: Foxglove_Pose { - get {return _pose ?? Foxglove_Pose()} - set {_pose = newValue} + get { _pose ?? Foxglove_Pose() } + set { _pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return self._pose != nil} + var hasPose: Bool { _pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {self._pose = nil} + mutating func clearPose() { _pose = nil } /// Number of bytes between points in the `data` var pointStride: UInt32 = 0 - /// Fields in `data`. At least 2 coordinate fields from `x`, `y`, and `z` are required for each point's position; `red`, `green`, `blue`, and `alpha` are optional for customizing each point's color. + /// Fields in `data`. At least 2 coordinate fields from `x`, `y`, and `z` are required for each point's position; + /// `red`, `green`, `blue`, and `alpha` are optional for customizing each point's color. var fields: [Foxglove_PackedElementField] = [] /// Point data, interpreted using `fields` - var data: Data = Data() + var data: Data = .init() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _pose: Foxglove_Pose? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + private var _pose: Foxglove_Pose? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_PointCloud: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_PointCloud: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_PointCloud: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_PointCloud: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".PointCloud" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -87,57 +93,57 @@ extension Foxglove_PointCloud: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl 6: .same(proto: "data"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._pose) }() - case 4: try { try decoder.decodeSingularFixed32Field(value: &self.pointStride) }() - case 5: try { try decoder.decodeRepeatedMessageField(value: &self.fields) }() - case 6: try { try decoder.decodeSingularBytesField(value: &self.data) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularStringField(value: &frameID) + case 3: try decoder.decodeSingularMessageField(value: &_pose) + case 4: try decoder.decodeSingularFixed32Field(value: &pointStride) + case 5: try decoder.decodeRepeatedMessageField(value: &fields) + case 6: try decoder.decodeSingularBytesField(value: &data) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.frameID.isEmpty { - try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) + } + if !frameID.isEmpty { + try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) } try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 3) } }() - if self.pointStride != 0 { - try visitor.visitSingularFixed32Field(value: self.pointStride, fieldNumber: 4) + if pointStride != 0 { + try visitor.visitSingularFixed32Field(value: pointStride, fieldNumber: 4) } - if !self.fields.isEmpty { - try visitor.visitRepeatedMessageField(value: self.fields, fieldNumber: 5) + if !fields.isEmpty { + try visitor.visitRepeatedMessageField(value: fields, fieldNumber: 5) } - if !self.data.isEmpty { - try visitor.visitSingularBytesField(value: self.data, fieldNumber: 6) + if !data.isEmpty { + try visitor.visitSingularBytesField(value: data, fieldNumber: 6) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_PointCloud, rhs: Foxglove_PointCloud) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.frameID != rhs.frameID {return false} - if lhs._pose != rhs._pose {return false} - if lhs.pointStride != rhs.pointStride {return false} - if lhs.fields != rhs.fields {return false} - if lhs.data != rhs.data {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_PointCloud, rhs: Foxglove_PointCloud) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.frameID != rhs.frameID { return false } + if lhs._pose != rhs._pose { return false } + if lhs.pointStride != rhs.pointStride { return false } + if lhs.fields != rhs.fields { return false } + if lhs.data != rhs.data { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/PointsAnnotation.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/PointsAnnotation.pb.swift index 4ed460b..a9ccebe 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/PointsAnnotation.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/PointsAnnotation.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,13 +30,14 @@ struct Foxglove_PointsAnnotation { /// Timestamp of annotation var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Type of points annotation to draw var type: Foxglove_PointsAnnotation.TypeEnum = .unknown @@ -46,26 +47,28 @@ struct Foxglove_PointsAnnotation { /// Outline color var outlineColor: Foxglove_Color { - get {return _outlineColor ?? Foxglove_Color()} - set {_outlineColor = newValue} + get { _outlineColor ?? Foxglove_Color() } + set { _outlineColor = newValue } } + /// Returns true if `outlineColor` has been explicitly set. - var hasOutlineColor: Bool {return self._outlineColor != nil} + var hasOutlineColor: Bool { _outlineColor != nil } /// Clears the value of `outlineColor`. Subsequent reads from it will return its default value. - mutating func clearOutlineColor() {self._outlineColor = nil} + mutating func clearOutlineColor() { _outlineColor = nil } /// Per-point colors, if `type` is `POINTS`, or per-segment stroke colors, if `type` is `LINE_LIST`. var outlineColors: [Foxglove_Color] = [] /// Fill color var fillColor: Foxglove_Color { - get {return _fillColor ?? Foxglove_Color()} - set {_fillColor = newValue} + get { _fillColor ?? Foxglove_Color() } + set { _fillColor = newValue } } + /// Returns true if `fillColor` has been explicitly set. - var hasFillColor: Bool {return self._fillColor != nil} + var hasFillColor: Bool { _fillColor != nil } /// Clears the value of `fillColor`. Subsequent reads from it will return its default value. - mutating func clearFillColor() {self._fillColor = nil} + mutating func clearFillColor() { _fillColor = nil } /// Stroke thickness in pixels var thickness: Double = 0 @@ -107,49 +110,50 @@ struct Foxglove_PointsAnnotation { var rawValue: Int { switch self { - case .unknown: return 0 - case .points: return 1 - case .lineLoop: return 2 - case .lineStrip: return 3 - case .lineList: return 4 - case .UNRECOGNIZED(let i): return i + case .unknown: 0 + case .points: 1 + case .lineLoop: 2 + case .lineStrip: 3 + case .lineList: 4 + case let .UNRECOGNIZED(i): i } } - } init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _outlineColor: Foxglove_Color? = nil - fileprivate var _fillColor: Foxglove_Color? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + private var _outlineColor: Foxglove_Color? + private var _fillColor: Foxglove_Color? } #if swift(>=4.2) -extension Foxglove_PointsAnnotation.TypeEnum: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_PointsAnnotation.TypeEnum] = [ - .unknown, - .points, - .lineLoop, - .lineStrip, - .lineList, - ] -} + extension Foxglove_PointsAnnotation.TypeEnum: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_PointsAnnotation.TypeEnum] = [ + .unknown, + .points, + .lineLoop, + .lineStrip, + .lineList, + ] + } -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_PointsAnnotation: @unchecked Sendable {} -extension Foxglove_PointsAnnotation.TypeEnum: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_PointsAnnotation: @unchecked Sendable {} + extension Foxglove_PointsAnnotation.TypeEnum: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_PointsAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_PointsAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".PointsAnnotation" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -161,62 +165,62 @@ extension Foxglove_PointsAnnotation: SwiftProtobuf.Message, SwiftProtobuf._Messa 7: .same(proto: "thickness"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularEnumField(value: &self.type) }() - case 3: try { try decoder.decodeRepeatedMessageField(value: &self.points) }() - case 4: try { try decoder.decodeSingularMessageField(value: &self._outlineColor) }() - case 5: try { try decoder.decodeRepeatedMessageField(value: &self.outlineColors) }() - case 6: try { try decoder.decodeSingularMessageField(value: &self._fillColor) }() - case 7: try { try decoder.decodeSingularDoubleField(value: &self.thickness) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularEnumField(value: &type) + case 3: try decoder.decodeRepeatedMessageField(value: &points) + case 4: try decoder.decodeSingularMessageField(value: &_outlineColor) + case 5: try decoder.decodeRepeatedMessageField(value: &outlineColors) + case 6: try decoder.decodeSingularMessageField(value: &_fillColor) + case 7: try decoder.decodeSingularDoubleField(value: &thickness) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if self.type != .unknown { - try visitor.visitSingularEnumField(value: self.type, fieldNumber: 2) } - if !self.points.isEmpty { - try visitor.visitRepeatedMessageField(value: self.points, fieldNumber: 3) + if type != .unknown { + try visitor.visitSingularEnumField(value: type, fieldNumber: 2) + } + if !points.isEmpty { + try visitor.visitRepeatedMessageField(value: points, fieldNumber: 3) } try { if let v = self._outlineColor { try visitor.visitSingularMessageField(value: v, fieldNumber: 4) } }() - if !self.outlineColors.isEmpty { - try visitor.visitRepeatedMessageField(value: self.outlineColors, fieldNumber: 5) + if !outlineColors.isEmpty { + try visitor.visitRepeatedMessageField(value: outlineColors, fieldNumber: 5) } try { if let v = self._fillColor { try visitor.visitSingularMessageField(value: v, fieldNumber: 6) } }() - if self.thickness != 0 { - try visitor.visitSingularDoubleField(value: self.thickness, fieldNumber: 7) + if thickness != 0 { + try visitor.visitSingularDoubleField(value: thickness, fieldNumber: 7) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_PointsAnnotation, rhs: Foxglove_PointsAnnotation) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.type != rhs.type {return false} - if lhs.points != rhs.points {return false} - if lhs._outlineColor != rhs._outlineColor {return false} - if lhs.outlineColors != rhs.outlineColors {return false} - if lhs._fillColor != rhs._fillColor {return false} - if lhs.thickness != rhs.thickness {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_PointsAnnotation, rhs: Foxglove_PointsAnnotation) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.type != rhs.type { return false } + if lhs.points != rhs.points { return false } + if lhs._outlineColor != rhs._outlineColor { return false } + if lhs.outlineColors != rhs.outlineColors { return false } + if lhs._fillColor != rhs._fillColor { return false } + if lhs.thickness != rhs.thickness { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Pose.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Pose.pb.swift index f049391..a38fc14 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Pose.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Pose.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,78 +30,82 @@ struct Foxglove_Pose { /// Point denoting position in 3D space var position: Foxglove_Vector3 { - get {return _position ?? Foxglove_Vector3()} - set {_position = newValue} + get { _position ?? Foxglove_Vector3() } + set { _position = newValue } } + /// Returns true if `position` has been explicitly set. - var hasPosition: Bool {return self._position != nil} + var hasPosition: Bool { _position != nil } /// Clears the value of `position`. Subsequent reads from it will return its default value. - mutating func clearPosition() {self._position = nil} + mutating func clearPosition() { _position = nil } /// Quaternion denoting orientation in 3D space var orientation: Foxglove_Quaternion { - get {return _orientation ?? Foxglove_Quaternion()} - set {_orientation = newValue} + get { _orientation ?? Foxglove_Quaternion() } + set { _orientation = newValue } } + /// Returns true if `orientation` has been explicitly set. - var hasOrientation: Bool {return self._orientation != nil} + var hasOrientation: Bool { _orientation != nil } /// Clears the value of `orientation`. Subsequent reads from it will return its default value. - mutating func clearOrientation() {self._orientation = nil} + mutating func clearOrientation() { _orientation = nil } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _position: Foxglove_Vector3? = nil - fileprivate var _orientation: Foxglove_Quaternion? = nil + private var _position: Foxglove_Vector3? + private var _orientation: Foxglove_Quaternion? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_Pose: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_Pose: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_Pose: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_Pose: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".Pose" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "position"), 2: .same(proto: "orientation"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._position) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._orientation) }() + case 1: try decoder.decodeSingularMessageField(value: &_position) + case 2: try decoder.decodeSingularMessageField(value: &_orientation) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._position { + if let v = _position { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() + } try { if let v = self._orientation { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_Pose, rhs: Foxglove_Pose) -> Bool { - if lhs._position != rhs._position {return false} - if lhs._orientation != rhs._orientation {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_Pose, rhs: Foxglove_Pose) -> Bool { + if lhs._position != rhs._position { return false } + if lhs._orientation != rhs._orientation { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/PoseInFrame.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/PoseInFrame.pb.swift index b8a8916..18e3359 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/PoseInFrame.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/PoseInFrame.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,44 +30,48 @@ struct Foxglove_PoseInFrame { /// Timestamp of pose var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Frame of reference for pose position and orientation - var frameID: String = String() + var frameID: String = .init() /// Pose in 3D space var pose: Foxglove_Pose { - get {return _pose ?? Foxglove_Pose()} - set {_pose = newValue} + get { _pose ?? Foxglove_Pose() } + set { _pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return self._pose != nil} + var hasPose: Bool { _pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {self._pose = nil} + mutating func clearPose() { _pose = nil } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _pose: Foxglove_Pose? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + private var _pose: Foxglove_Pose? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_PoseInFrame: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_PoseInFrame: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_PoseInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_PoseInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".PoseInFrame" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -75,30 +79,30 @@ extension Foxglove_PoseInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImp 3: .same(proto: "pose"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._pose) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularStringField(value: &frameID) + case 3: try decoder.decodeSingularMessageField(value: &_pose) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.frameID.isEmpty { - try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) + } + if !frameID.isEmpty { + try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) } try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 3) @@ -106,11 +110,11 @@ extension Foxglove_PoseInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImp try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_PoseInFrame, rhs: Foxglove_PoseInFrame) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.frameID != rhs.frameID {return false} - if lhs._pose != rhs._pose {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_PoseInFrame, rhs: Foxglove_PoseInFrame) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.frameID != rhs.frameID { return false } + if lhs._pose != rhs._pose { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/PosesInFrame.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/PosesInFrame.pb.swift index dd40226..e2001df 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/PosesInFrame.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/PosesInFrame.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,16 +30,17 @@ struct Foxglove_PosesInFrame { /// Timestamp of pose var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Frame of reference for pose position and orientation - var frameID: String = String() + var frameID: String = .init() /// Poses in 3D space var poses: [Foxglove_Pose] = [] @@ -48,18 +49,20 @@ struct Foxglove_PosesInFrame { init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_PosesInFrame: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_PosesInFrame: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_PosesInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_PosesInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".PosesInFrame" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -67,42 +70,42 @@ extension Foxglove_PosesInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageIm 3: .same(proto: "poses"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() - case 3: try { try decoder.decodeRepeatedMessageField(value: &self.poses) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularStringField(value: &frameID) + case 3: try decoder.decodeRepeatedMessageField(value: &poses) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.frameID.isEmpty { - try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) } - if !self.poses.isEmpty { - try visitor.visitRepeatedMessageField(value: self.poses, fieldNumber: 3) + if !frameID.isEmpty { + try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) + } + if !poses.isEmpty { + try visitor.visitRepeatedMessageField(value: poses, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_PosesInFrame, rhs: Foxglove_PosesInFrame) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.frameID != rhs.frameID {return false} - if lhs.poses != rhs.poses {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_PosesInFrame, rhs: Foxglove_PosesInFrame) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.frameID != rhs.frameID { return false } + if lhs.poses != rhs.poses { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Quaternion.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Quaternion.pb.swift index 3fa5cad..ffbbff1 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Quaternion.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Quaternion.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -46,14 +46,16 @@ struct Foxglove_Quaternion { } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_Quaternion: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_Quaternion: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_Quaternion: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_Quaternion: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".Quaternion" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "x"), @@ -62,43 +64,43 @@ extension Foxglove_Quaternion: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl 4: .same(proto: "w"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularDoubleField(value: &self.x) }() - case 2: try { try decoder.decodeSingularDoubleField(value: &self.y) }() - case 3: try { try decoder.decodeSingularDoubleField(value: &self.z) }() - case 4: try { try decoder.decodeSingularDoubleField(value: &self.w) }() + case 1: try decoder.decodeSingularDoubleField(value: &x) + case 2: try decoder.decodeSingularDoubleField(value: &y) + case 3: try decoder.decodeSingularDoubleField(value: &z) + case 4: try decoder.decodeSingularDoubleField(value: &w) default: break } } } - func traverse(visitor: inout V) throws { - if self.x != 0 { - try visitor.visitSingularDoubleField(value: self.x, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if x != 0 { + try visitor.visitSingularDoubleField(value: x, fieldNumber: 1) } - if self.y != 0 { - try visitor.visitSingularDoubleField(value: self.y, fieldNumber: 2) + if y != 0 { + try visitor.visitSingularDoubleField(value: y, fieldNumber: 2) } - if self.z != 0 { - try visitor.visitSingularDoubleField(value: self.z, fieldNumber: 3) + if z != 0 { + try visitor.visitSingularDoubleField(value: z, fieldNumber: 3) } - if self.w != 0 { - try visitor.visitSingularDoubleField(value: self.w, fieldNumber: 4) + if w != 0 { + try visitor.visitSingularDoubleField(value: w, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_Quaternion, rhs: Foxglove_Quaternion) -> Bool { - if lhs.x != rhs.x {return false} - if lhs.y != rhs.y {return false} - if lhs.z != rhs.z {return false} - if lhs.w != rhs.w {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_Quaternion, rhs: Foxglove_Quaternion) -> Bool { + if lhs.x != rhs.x { return false } + if lhs.y != rhs.y { return false } + if lhs.z != rhs.z { return false } + if lhs.w != rhs.w { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/RawImage.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/RawImage.pb.swift index f02408d..487dadf 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/RawImage.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/RawImage.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,16 +30,18 @@ struct Foxglove_RawImage { /// Timestamp of image var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } - /// Frame of reference for the image. The origin of the frame is the optical center of the camera. +x points to the right in the image, +y points down, and +z points into the plane of the image. - var frameID: String = String() + /// Frame of reference for the image. The origin of the frame is the optical center of the camera. +x points to the + /// right in the image, +y points down, and +z points into the plane of the image. + var frameID: String = .init() /// Image width var width: UInt32 = 0 @@ -48,32 +50,35 @@ struct Foxglove_RawImage { var height: UInt32 = 0 /// Encoding of the raw image data - /// - /// Supported values: `8UC1`, `8UC3`, `16UC1`, `32FC1`, `bayer_bggr8`, `bayer_gbrg8`, `bayer_grbg8`, `bayer_rggb8`, `bgr8`, `bgra8`, `mono8`, `mono16`, `rgb8`, `rgba8`, `uyvy` or `yuv422`, `yuyv` or `yuv422_yuy2` - var encoding: String = String() + /// + /// Supported values: `8UC1`, `8UC3`, `16UC1`, `32FC1`, `bayer_bggr8`, `bayer_gbrg8`, `bayer_grbg8`, `bayer_rggb8`, + /// `bgr8`, `bgra8`, `mono8`, `mono16`, `rgb8`, `rgba8`, `uyvy` or `yuv422`, `yuyv` or `yuv422_yuy2` + var encoding: String = .init() /// Byte length of a single row var step: UInt32 = 0 /// Raw image data - var data: Data = Data() + var data: Data = .init() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_RawImage: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_RawImage: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_RawImage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_RawImage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".RawImage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -85,62 +90,62 @@ extension Foxglove_RawImage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem 6: .same(proto: "data"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularFixed32Field(value: &self.width) }() - case 3: try { try decoder.decodeSingularFixed32Field(value: &self.height) }() - case 4: try { try decoder.decodeSingularStringField(value: &self.encoding) }() - case 5: try { try decoder.decodeSingularFixed32Field(value: &self.step) }() - case 6: try { try decoder.decodeSingularBytesField(value: &self.data) }() - case 7: try { try decoder.decodeSingularStringField(value: &self.frameID) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularFixed32Field(value: &width) + case 3: try decoder.decodeSingularFixed32Field(value: &height) + case 4: try decoder.decodeSingularStringField(value: &encoding) + case 5: try decoder.decodeSingularFixed32Field(value: &step) + case 6: try decoder.decodeSingularBytesField(value: &data) + case 7: try decoder.decodeSingularStringField(value: &frameID) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if self.width != 0 { - try visitor.visitSingularFixed32Field(value: self.width, fieldNumber: 2) } - if self.height != 0 { - try visitor.visitSingularFixed32Field(value: self.height, fieldNumber: 3) + if width != 0 { + try visitor.visitSingularFixed32Field(value: width, fieldNumber: 2) + } + if height != 0 { + try visitor.visitSingularFixed32Field(value: height, fieldNumber: 3) } - if !self.encoding.isEmpty { - try visitor.visitSingularStringField(value: self.encoding, fieldNumber: 4) + if !encoding.isEmpty { + try visitor.visitSingularStringField(value: encoding, fieldNumber: 4) } - if self.step != 0 { - try visitor.visitSingularFixed32Field(value: self.step, fieldNumber: 5) + if step != 0 { + try visitor.visitSingularFixed32Field(value: step, fieldNumber: 5) } - if !self.data.isEmpty { - try visitor.visitSingularBytesField(value: self.data, fieldNumber: 6) + if !data.isEmpty { + try visitor.visitSingularBytesField(value: data, fieldNumber: 6) } - if !self.frameID.isEmpty { - try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 7) + if !frameID.isEmpty { + try visitor.visitSingularStringField(value: frameID, fieldNumber: 7) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_RawImage, rhs: Foxglove_RawImage) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.frameID != rhs.frameID {return false} - if lhs.width != rhs.width {return false} - if lhs.height != rhs.height {return false} - if lhs.encoding != rhs.encoding {return false} - if lhs.step != rhs.step {return false} - if lhs.data != rhs.data {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_RawImage, rhs: Foxglove_RawImage) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.frameID != rhs.frameID { return false } + if lhs.width != rhs.width { return false } + if lhs.height != rhs.height { return false } + if lhs.encoding != rhs.encoding { return false } + if lhs.step != rhs.step { return false } + if lhs.data != rhs.data { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/SceneEntity.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/SceneEntity.pb.swift index 55364d3..dc51093 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/SceneEntity.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/SceneEntity.pb.swift @@ -17,12 +17,13 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } -/// A visual element in a 3D scene. An entity may be composed of multiple primitives which all share the same frame of reference. +/// A visual element in a 3D scene. An entity may be composed of multiple primitives which all share the same frame of +/// reference. struct Foxglove_SceneEntity { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -30,31 +31,35 @@ struct Foxglove_SceneEntity { /// Timestamp of the entity var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Frame of reference - var frameID: String = String() + var frameID: String = .init() /// Identifier for the entity. A entity will replace any prior entity on the same topic with the same `id`. - var id: String = String() + var id: String = .init() - /// Length of time (relative to `timestamp`) after which the entity should be automatically removed. Zero value indicates the entity should remain visible until it is replaced or deleted. + /// Length of time (relative to `timestamp`) after which the entity should be automatically removed. Zero value + /// indicates the entity should remain visible until it is replaced or deleted. var lifetime: SwiftProtobuf.Google_Protobuf_Duration { - get {return _lifetime ?? SwiftProtobuf.Google_Protobuf_Duration()} - set {_lifetime = newValue} + get { _lifetime ?? SwiftProtobuf.Google_Protobuf_Duration() } + set { _lifetime = newValue } } + /// Returns true if `lifetime` has been explicitly set. - var hasLifetime: Bool {return self._lifetime != nil} + var hasLifetime: Bool { _lifetime != nil } /// Clears the value of `lifetime`. Subsequent reads from it will return its default value. - mutating func clearLifetime() {self._lifetime = nil} + mutating func clearLifetime() { _lifetime = nil } - /// Whether the entity should keep its location in the fixed frame (false) or follow the frame specified in `frame_id` as it moves relative to the fixed frame (true) + /// Whether the entity should keep its location in the fixed frame (false) or follow the frame specified in `frame_id` + /// as it moves relative to the fixed frame (true) var frameLocked: Bool = false /// Additional user-provided metadata associated with the entity. Keys must be unique. @@ -88,19 +93,21 @@ struct Foxglove_SceneEntity { init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _lifetime: SwiftProtobuf.Google_Protobuf_Duration? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + private var _lifetime: SwiftProtobuf.Google_Protobuf_Duration? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_SceneEntity: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_SceneEntity: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_SceneEntity: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_SceneEntity: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".SceneEntity" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -119,97 +126,97 @@ extension Foxglove_SceneEntity: SwiftProtobuf.Message, SwiftProtobuf._MessageImp 14: .same(proto: "models"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.id) }() - case 4: try { try decoder.decodeSingularMessageField(value: &self._lifetime) }() - case 5: try { try decoder.decodeSingularBoolField(value: &self.frameLocked) }() - case 6: try { try decoder.decodeRepeatedMessageField(value: &self.metadata) }() - case 7: try { try decoder.decodeRepeatedMessageField(value: &self.arrows) }() - case 8: try { try decoder.decodeRepeatedMessageField(value: &self.cubes) }() - case 9: try { try decoder.decodeRepeatedMessageField(value: &self.spheres) }() - case 10: try { try decoder.decodeRepeatedMessageField(value: &self.cylinders) }() - case 11: try { try decoder.decodeRepeatedMessageField(value: &self.lines) }() - case 12: try { try decoder.decodeRepeatedMessageField(value: &self.triangles) }() - case 13: try { try decoder.decodeRepeatedMessageField(value: &self.texts) }() - case 14: try { try decoder.decodeRepeatedMessageField(value: &self.models) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularStringField(value: &frameID) + case 3: try decoder.decodeSingularStringField(value: &id) + case 4: try decoder.decodeSingularMessageField(value: &_lifetime) + case 5: try decoder.decodeSingularBoolField(value: &frameLocked) + case 6: try decoder.decodeRepeatedMessageField(value: &metadata) + case 7: try decoder.decodeRepeatedMessageField(value: &arrows) + case 8: try decoder.decodeRepeatedMessageField(value: &cubes) + case 9: try decoder.decodeRepeatedMessageField(value: &spheres) + case 10: try decoder.decodeRepeatedMessageField(value: &cylinders) + case 11: try decoder.decodeRepeatedMessageField(value: &lines) + case 12: try decoder.decodeRepeatedMessageField(value: &triangles) + case 13: try decoder.decodeRepeatedMessageField(value: &texts) + case 14: try decoder.decodeRepeatedMessageField(value: &models) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.frameID.isEmpty { - try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) } - if !self.id.isEmpty { - try visitor.visitSingularStringField(value: self.id, fieldNumber: 3) + if !frameID.isEmpty { + try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) + } + if !id.isEmpty { + try visitor.visitSingularStringField(value: id, fieldNumber: 3) } try { if let v = self._lifetime { try visitor.visitSingularMessageField(value: v, fieldNumber: 4) } }() - if self.frameLocked != false { - try visitor.visitSingularBoolField(value: self.frameLocked, fieldNumber: 5) + if frameLocked != false { + try visitor.visitSingularBoolField(value: frameLocked, fieldNumber: 5) } - if !self.metadata.isEmpty { - try visitor.visitRepeatedMessageField(value: self.metadata, fieldNumber: 6) + if !metadata.isEmpty { + try visitor.visitRepeatedMessageField(value: metadata, fieldNumber: 6) } - if !self.arrows.isEmpty { - try visitor.visitRepeatedMessageField(value: self.arrows, fieldNumber: 7) + if !arrows.isEmpty { + try visitor.visitRepeatedMessageField(value: arrows, fieldNumber: 7) } - if !self.cubes.isEmpty { - try visitor.visitRepeatedMessageField(value: self.cubes, fieldNumber: 8) + if !cubes.isEmpty { + try visitor.visitRepeatedMessageField(value: cubes, fieldNumber: 8) } - if !self.spheres.isEmpty { - try visitor.visitRepeatedMessageField(value: self.spheres, fieldNumber: 9) + if !spheres.isEmpty { + try visitor.visitRepeatedMessageField(value: spheres, fieldNumber: 9) } - if !self.cylinders.isEmpty { - try visitor.visitRepeatedMessageField(value: self.cylinders, fieldNumber: 10) + if !cylinders.isEmpty { + try visitor.visitRepeatedMessageField(value: cylinders, fieldNumber: 10) } - if !self.lines.isEmpty { - try visitor.visitRepeatedMessageField(value: self.lines, fieldNumber: 11) + if !lines.isEmpty { + try visitor.visitRepeatedMessageField(value: lines, fieldNumber: 11) } - if !self.triangles.isEmpty { - try visitor.visitRepeatedMessageField(value: self.triangles, fieldNumber: 12) + if !triangles.isEmpty { + try visitor.visitRepeatedMessageField(value: triangles, fieldNumber: 12) } - if !self.texts.isEmpty { - try visitor.visitRepeatedMessageField(value: self.texts, fieldNumber: 13) + if !texts.isEmpty { + try visitor.visitRepeatedMessageField(value: texts, fieldNumber: 13) } - if !self.models.isEmpty { - try visitor.visitRepeatedMessageField(value: self.models, fieldNumber: 14) + if !models.isEmpty { + try visitor.visitRepeatedMessageField(value: models, fieldNumber: 14) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_SceneEntity, rhs: Foxglove_SceneEntity) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.frameID != rhs.frameID {return false} - if lhs.id != rhs.id {return false} - if lhs._lifetime != rhs._lifetime {return false} - if lhs.frameLocked != rhs.frameLocked {return false} - if lhs.metadata != rhs.metadata {return false} - if lhs.arrows != rhs.arrows {return false} - if lhs.cubes != rhs.cubes {return false} - if lhs.spheres != rhs.spheres {return false} - if lhs.cylinders != rhs.cylinders {return false} - if lhs.lines != rhs.lines {return false} - if lhs.triangles != rhs.triangles {return false} - if lhs.texts != rhs.texts {return false} - if lhs.models != rhs.models {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_SceneEntity, rhs: Foxglove_SceneEntity) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.frameID != rhs.frameID { return false } + if lhs.id != rhs.id { return false } + if lhs._lifetime != rhs._lifetime { return false } + if lhs.frameLocked != rhs.frameLocked { return false } + if lhs.metadata != rhs.metadata { return false } + if lhs.arrows != rhs.arrows { return false } + if lhs.cubes != rhs.cubes { return false } + if lhs.spheres != rhs.spheres { return false } + if lhs.cylinders != rhs.cylinders { return false } + if lhs.lines != rhs.lines { return false } + if lhs.triangles != rhs.triangles { return false } + if lhs.texts != rhs.texts { return false } + if lhs.models != rhs.models { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/SceneEntityDeletion.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/SceneEntityDeletion.pb.swift index a783ce5..6fbfc0d 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/SceneEntityDeletion.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/SceneEntityDeletion.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,19 +30,20 @@ struct Foxglove_SceneEntityDeletion { /// Timestamp of the deletion. Only matching entities earlier than this timestamp will be deleted. var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Type of deletion action to perform var type: Foxglove_SceneEntityDeletion.TypeEnum = .matchingID /// Identifier which must match if `type` is `MATCHING_ID`. - var id: String = String() + var id: String = .init() var unknownFields = SwiftProtobuf.UnknownStorage() @@ -71,41 +72,42 @@ struct Foxglove_SceneEntityDeletion { var rawValue: Int { switch self { - case .matchingID: return 0 - case .all: return 1 - case .UNRECOGNIZED(let i): return i + case .matchingID: 0 + case .all: 1 + case let .UNRECOGNIZED(i): i } } - } init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? } #if swift(>=4.2) -extension Foxglove_SceneEntityDeletion.TypeEnum: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_SceneEntityDeletion.TypeEnum] = [ - .matchingID, - .all, - ] -} + extension Foxglove_SceneEntityDeletion.TypeEnum: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_SceneEntityDeletion.TypeEnum] = [ + .matchingID, + .all, + ] + } -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_SceneEntityDeletion: @unchecked Sendable {} -extension Foxglove_SceneEntityDeletion.TypeEnum: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_SceneEntityDeletion: @unchecked Sendable {} + extension Foxglove_SceneEntityDeletion.TypeEnum: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_SceneEntityDeletion: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_SceneEntityDeletion: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".SceneEntityDeletion" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -113,42 +115,42 @@ extension Foxglove_SceneEntityDeletion: SwiftProtobuf.Message, SwiftProtobuf._Me 3: .same(proto: "id"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularEnumField(value: &self.type) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.id) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularEnumField(value: &type) + case 3: try decoder.decodeSingularStringField(value: &id) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if self.type != .matchingID { - try visitor.visitSingularEnumField(value: self.type, fieldNumber: 2) } - if !self.id.isEmpty { - try visitor.visitSingularStringField(value: self.id, fieldNumber: 3) + if type != .matchingID { + try visitor.visitSingularEnumField(value: type, fieldNumber: 2) + } + if !id.isEmpty { + try visitor.visitSingularStringField(value: id, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_SceneEntityDeletion, rhs: Foxglove_SceneEntityDeletion) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.type != rhs.type {return false} - if lhs.id != rhs.id {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_SceneEntityDeletion, rhs: Foxglove_SceneEntityDeletion) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs.type != rhs.type { return false } + if lhs.id != rhs.id { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/SceneUpdate.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/SceneUpdate.pb.swift index a80d8d0..f77eb12 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/SceneUpdate.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/SceneUpdate.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -40,47 +40,49 @@ struct Foxglove_SceneUpdate { } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_SceneUpdate: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_SceneUpdate: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_SceneUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_SceneUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".SceneUpdate" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "deletions"), 2: .same(proto: "entities"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.deletions) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.entities) }() + case 1: try decoder.decodeRepeatedMessageField(value: &deletions) + case 2: try decoder.decodeRepeatedMessageField(value: &entities) default: break } } } - func traverse(visitor: inout V) throws { - if !self.deletions.isEmpty { - try visitor.visitRepeatedMessageField(value: self.deletions, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if !deletions.isEmpty { + try visitor.visitRepeatedMessageField(value: deletions, fieldNumber: 1) } - if !self.entities.isEmpty { - try visitor.visitRepeatedMessageField(value: self.entities, fieldNumber: 2) + if !entities.isEmpty { + try visitor.visitRepeatedMessageField(value: entities, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_SceneUpdate, rhs: Foxglove_SceneUpdate) -> Bool { - if lhs.deletions != rhs.deletions {return false} - if lhs.entities != rhs.entities {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_SceneUpdate, rhs: Foxglove_SceneUpdate) -> Bool { + if lhs.deletions != rhs.deletions { return false } + if lhs.entities != rhs.entities { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/SpherePrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/SpherePrimitive.pb.swift index 288c084..e245750 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/SpherePrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/SpherePrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,52 +30,57 @@ struct Foxglove_SpherePrimitive { /// Position of the center of the sphere and orientation of the sphere var pose: Foxglove_Pose { - get {return _pose ?? Foxglove_Pose()} - set {_pose = newValue} + get { _pose ?? Foxglove_Pose() } + set { _pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return self._pose != nil} + var hasPose: Bool { _pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {self._pose = nil} + mutating func clearPose() { _pose = nil } /// Size (diameter) of the sphere along each axis var size: Foxglove_Vector3 { - get {return _size ?? Foxglove_Vector3()} - set {_size = newValue} + get { _size ?? Foxglove_Vector3() } + set { _size = newValue } } + /// Returns true if `size` has been explicitly set. - var hasSize: Bool {return self._size != nil} + var hasSize: Bool { _size != nil } /// Clears the value of `size`. Subsequent reads from it will return its default value. - mutating func clearSize() {self._size = nil} + mutating func clearSize() { _size = nil } /// Color of the sphere var color: Foxglove_Color { - get {return _color ?? Foxglove_Color()} - set {_color = newValue} + get { _color ?? Foxglove_Color() } + set { _color = newValue } } + /// Returns true if `color` has been explicitly set. - var hasColor: Bool {return self._color != nil} + var hasColor: Bool { _color != nil } /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() {self._color = nil} + mutating func clearColor() { _color = nil } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _pose: Foxglove_Pose? = nil - fileprivate var _size: Foxglove_Vector3? = nil - fileprivate var _color: Foxglove_Color? = nil + private var _pose: Foxglove_Pose? + private var _size: Foxglove_Vector3? + private var _color: Foxglove_Color? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_SpherePrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_SpherePrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_SpherePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_SpherePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".SpherePrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -83,28 +88,28 @@ extension Foxglove_SpherePrimitive: SwiftProtobuf.Message, SwiftProtobuf._Messag 3: .same(proto: "color"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._size) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._color) }() + case 1: try decoder.decodeSingularMessageField(value: &_pose) + case 2: try decoder.decodeSingularMessageField(value: &_size) + case 3: try decoder.decodeSingularMessageField(value: &_color) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._pose { + if let v = _pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() + } try { if let v = self._size { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() @@ -114,11 +119,11 @@ extension Foxglove_SpherePrimitive: SwiftProtobuf.Message, SwiftProtobuf._Messag try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_SpherePrimitive, rhs: Foxglove_SpherePrimitive) -> Bool { - if lhs._pose != rhs._pose {return false} - if lhs._size != rhs._size {return false} - if lhs._color != rhs._color {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_SpherePrimitive, rhs: Foxglove_SpherePrimitive) -> Bool { + if lhs._pose != rhs._pose { return false } + if lhs._size != rhs._size { return false } + if lhs._color != rhs._color { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/TextAnnotation.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/TextAnnotation.pb.swift index e463ec0..c79131e 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/TextAnnotation.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/TextAnnotation.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,69 +30,75 @@ struct Foxglove_TextAnnotation { /// Timestamp of annotation var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} + get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } + set { _timestamp = newValue } } + /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} + var hasTimestamp: Bool { _timestamp != nil } /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} + mutating func clearTimestamp() { _timestamp = nil } /// Bottom-left origin of the text label in 2D image coordinates (pixels) var position: Foxglove_Point2 { - get {return _position ?? Foxglove_Point2()} - set {_position = newValue} + get { _position ?? Foxglove_Point2() } + set { _position = newValue } } + /// Returns true if `position` has been explicitly set. - var hasPosition: Bool {return self._position != nil} + var hasPosition: Bool { _position != nil } /// Clears the value of `position`. Subsequent reads from it will return its default value. - mutating func clearPosition() {self._position = nil} + mutating func clearPosition() { _position = nil } /// Text to display - var text: String = String() + var text: String = .init() /// Font size in pixels var fontSize: Double = 0 /// Text color var textColor: Foxglove_Color { - get {return _textColor ?? Foxglove_Color()} - set {_textColor = newValue} + get { _textColor ?? Foxglove_Color() } + set { _textColor = newValue } } + /// Returns true if `textColor` has been explicitly set. - var hasTextColor: Bool {return self._textColor != nil} + var hasTextColor: Bool { _textColor != nil } /// Clears the value of `textColor`. Subsequent reads from it will return its default value. - mutating func clearTextColor() {self._textColor = nil} + mutating func clearTextColor() { _textColor = nil } /// Background fill color var backgroundColor: Foxglove_Color { - get {return _backgroundColor ?? Foxglove_Color()} - set {_backgroundColor = newValue} + get { _backgroundColor ?? Foxglove_Color() } + set { _backgroundColor = newValue } } + /// Returns true if `backgroundColor` has been explicitly set. - var hasBackgroundColor: Bool {return self._backgroundColor != nil} + var hasBackgroundColor: Bool { _backgroundColor != nil } /// Clears the value of `backgroundColor`. Subsequent reads from it will return its default value. - mutating func clearBackgroundColor() {self._backgroundColor = nil} + mutating func clearBackgroundColor() { _backgroundColor = nil } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _position: Foxglove_Point2? = nil - fileprivate var _textColor: Foxglove_Color? = nil - fileprivate var _backgroundColor: Foxglove_Color? = nil + private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + private var _position: Foxglove_Point2? + private var _textColor: Foxglove_Color? + private var _backgroundColor: Foxglove_Color? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_TextAnnotation: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_TextAnnotation: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_TextAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_TextAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".TextAnnotation" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -103,39 +109,39 @@ extension Foxglove_TextAnnotation: SwiftProtobuf.Message, SwiftProtobuf._Message 6: .standard(proto: "background_color"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._position) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.text) }() - case 4: try { try decoder.decodeSingularDoubleField(value: &self.fontSize) }() - case 5: try { try decoder.decodeSingularMessageField(value: &self._textColor) }() - case 6: try { try decoder.decodeSingularMessageField(value: &self._backgroundColor) }() + case 1: try decoder.decodeSingularMessageField(value: &_timestamp) + case 2: try decoder.decodeSingularMessageField(value: &_position) + case 3: try decoder.decodeSingularStringField(value: &text) + case 4: try decoder.decodeSingularDoubleField(value: &fontSize) + case 5: try decoder.decodeSingularMessageField(value: &_textColor) + case 6: try decoder.decodeSingularMessageField(value: &_backgroundColor) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { + if let v = _timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() + } try { if let v = self._position { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() - if !self.text.isEmpty { - try visitor.visitSingularStringField(value: self.text, fieldNumber: 3) + if !text.isEmpty { + try visitor.visitSingularStringField(value: text, fieldNumber: 3) } - if self.fontSize != 0 { - try visitor.visitSingularDoubleField(value: self.fontSize, fieldNumber: 4) + if fontSize != 0 { + try visitor.visitSingularDoubleField(value: fontSize, fieldNumber: 4) } try { if let v = self._textColor { try visitor.visitSingularMessageField(value: v, fieldNumber: 5) @@ -146,14 +152,14 @@ extension Foxglove_TextAnnotation: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_TextAnnotation, rhs: Foxglove_TextAnnotation) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs._position != rhs._position {return false} - if lhs.text != rhs.text {return false} - if lhs.fontSize != rhs.fontSize {return false} - if lhs._textColor != rhs._textColor {return false} - if lhs._backgroundColor != rhs._backgroundColor {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_TextAnnotation, rhs: Foxglove_TextAnnotation) -> Bool { + if lhs._timestamp != rhs._timestamp { return false } + if lhs._position != rhs._position { return false } + if lhs.text != rhs.text { return false } + if lhs.fontSize != rhs.fontSize { return false } + if lhs._textColor != rhs._textColor { return false } + if lhs._backgroundColor != rhs._backgroundColor { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/TextPrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/TextPrimitive.pb.swift index 56d96db..1470186 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/TextPrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/TextPrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -28,15 +28,17 @@ struct Foxglove_TextPrimitive { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - /// Position of the center of the text box and orientation of the text. Identity orientation means the text is oriented in the xy-plane and flows from -x to +x. + /// Position of the center of the text box and orientation of the text. Identity orientation means the text is + /// oriented in the xy-plane and flows from -x to +x. var pose: Foxglove_Pose { - get {return _pose ?? Foxglove_Pose()} - set {_pose = newValue} + get { _pose ?? Foxglove_Pose() } + set { _pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return self._pose != nil} + var hasPose: Bool { _pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {self._pose = nil} + mutating func clearPose() { _pose = nil } /// Whether the text should respect `pose.orientation` (false) or always face the camera (true) var billboard: Bool = false @@ -44,39 +46,43 @@ struct Foxglove_TextPrimitive { /// Font size (height of one line of text) var fontSize: Double = 0 - /// Indicates whether `font_size` is a fixed size in screen pixels (true), or specified in world coordinates and scales with distance from the camera (false) + /// Indicates whether `font_size` is a fixed size in screen pixels (true), or specified in world coordinates and + /// scales with distance from the camera (false) var scaleInvariant: Bool = false /// Color of the text var color: Foxglove_Color { - get {return _color ?? Foxglove_Color()} - set {_color = newValue} + get { _color ?? Foxglove_Color() } + set { _color = newValue } } + /// Returns true if `color` has been explicitly set. - var hasColor: Bool {return self._color != nil} + var hasColor: Bool { _color != nil } /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() {self._color = nil} + mutating func clearColor() { _color = nil } /// Text - var text: String = String() + var text: String = .init() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _pose: Foxglove_Pose? = nil - fileprivate var _color: Foxglove_Color? = nil + private var _pose: Foxglove_Pose? + private var _color: Foxglove_Color? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_TextPrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_TextPrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_TextPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_TextPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".TextPrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -87,57 +93,57 @@ extension Foxglove_TextPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI 6: .same(proto: "text"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() - case 2: try { try decoder.decodeSingularBoolField(value: &self.billboard) }() - case 3: try { try decoder.decodeSingularDoubleField(value: &self.fontSize) }() - case 4: try { try decoder.decodeSingularBoolField(value: &self.scaleInvariant) }() - case 5: try { try decoder.decodeSingularMessageField(value: &self._color) }() - case 6: try { try decoder.decodeSingularStringField(value: &self.text) }() + case 1: try decoder.decodeSingularMessageField(value: &_pose) + case 2: try decoder.decodeSingularBoolField(value: &billboard) + case 3: try decoder.decodeSingularDoubleField(value: &fontSize) + case 4: try decoder.decodeSingularBoolField(value: &scaleInvariant) + case 5: try decoder.decodeSingularMessageField(value: &_color) + case 6: try decoder.decodeSingularStringField(value: &text) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._pose { + if let v = _pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if self.billboard != false { - try visitor.visitSingularBoolField(value: self.billboard, fieldNumber: 2) } - if self.fontSize != 0 { - try visitor.visitSingularDoubleField(value: self.fontSize, fieldNumber: 3) + if billboard != false { + try visitor.visitSingularBoolField(value: billboard, fieldNumber: 2) + } + if fontSize != 0 { + try visitor.visitSingularDoubleField(value: fontSize, fieldNumber: 3) } - if self.scaleInvariant != false { - try visitor.visitSingularBoolField(value: self.scaleInvariant, fieldNumber: 4) + if scaleInvariant != false { + try visitor.visitSingularBoolField(value: scaleInvariant, fieldNumber: 4) } try { if let v = self._color { try visitor.visitSingularMessageField(value: v, fieldNumber: 5) } }() - if !self.text.isEmpty { - try visitor.visitSingularStringField(value: self.text, fieldNumber: 6) + if !text.isEmpty { + try visitor.visitSingularStringField(value: text, fieldNumber: 6) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_TextPrimitive, rhs: Foxglove_TextPrimitive) -> Bool { - if lhs._pose != rhs._pose {return false} - if lhs.billboard != rhs.billboard {return false} - if lhs.fontSize != rhs.fontSize {return false} - if lhs.scaleInvariant != rhs.scaleInvariant {return false} - if lhs._color != rhs._color {return false} - if lhs.text != rhs.text {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_TextPrimitive, rhs: Foxglove_TextPrimitive) -> Bool { + if lhs._pose != rhs._pose { return false } + if lhs.billboard != rhs.billboard { return false } + if lhs.fontSize != rhs.fontSize { return false } + if lhs.scaleInvariant != rhs.scaleInvariant { return false } + if lhs._color != rhs._color { return false } + if lhs.text != rhs.text { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/TriangleListPrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/TriangleListPrimitive.pb.swift index 82f033e..e70068c 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/TriangleListPrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/TriangleListPrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,52 +30,58 @@ struct Foxglove_TriangleListPrimitive { /// Origin of triangles relative to reference frame var pose: Foxglove_Pose { - get {return _pose ?? Foxglove_Pose()} - set {_pose = newValue} + get { _pose ?? Foxglove_Pose() } + set { _pose = newValue } } + /// Returns true if `pose` has been explicitly set. - var hasPose: Bool {return self._pose != nil} + var hasPose: Bool { _pose != nil } /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() {self._pose = nil} + mutating func clearPose() { _pose = nil } /// Vertices to use for triangles, interpreted as a list of triples (0-1-2, 3-4-5, ...) var points: [Foxglove_Point3] = [] /// Solid color to use for the whole shape. One of `color` or `colors` must be provided. var color: Foxglove_Color { - get {return _color ?? Foxglove_Color()} - set {_color = newValue} + get { _color ?? Foxglove_Color() } + set { _color = newValue } } + /// Returns true if `color` has been explicitly set. - var hasColor: Bool {return self._color != nil} + var hasColor: Bool { _color != nil } /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() {self._color = nil} + mutating func clearColor() { _color = nil } - /// Per-vertex colors (if specified, must have the same length as `points`). One of `color` or `colors` must be provided. + /// Per-vertex colors (if specified, must have the same length as `points`). One of `color` or `colors` must be + /// provided. var colors: [Foxglove_Color] = [] /// Indices into the `points` and `colors` attribute arrays, which can be used to avoid duplicating attribute data. - /// - /// If omitted or empty, indexing will not be used. This default behavior is equivalent to specifying [0, 1, ..., N-1] for the indices (where N is the number of `points` provided). + /// + /// If omitted or empty, indexing will not be used. This default behavior is equivalent to specifying [0, 1, ..., N-1] + /// for the indices (where N is the number of `points` provided). var indices: [UInt32] = [] var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - fileprivate var _pose: Foxglove_Pose? = nil - fileprivate var _color: Foxglove_Color? = nil + private var _pose: Foxglove_Pose? + private var _color: Foxglove_Color? } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_TriangleListPrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_TriangleListPrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_TriangleListPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_TriangleListPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".TriangleListPrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -85,52 +91,52 @@ extension Foxglove_TriangleListPrimitive: SwiftProtobuf.Message, SwiftProtobuf._ 5: .same(proto: "indices"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.points) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._color) }() - case 4: try { try decoder.decodeRepeatedMessageField(value: &self.colors) }() - case 5: try { try decoder.decodeRepeatedFixed32Field(value: &self.indices) }() + case 1: try decoder.decodeSingularMessageField(value: &_pose) + case 2: try decoder.decodeRepeatedMessageField(value: &points) + case 3: try decoder.decodeSingularMessageField(value: &_color) + case 4: try decoder.decodeRepeatedMessageField(value: &colors) + case 5: try decoder.decodeRepeatedFixed32Field(value: &indices) default: break } } } - func traverse(visitor: inout V) throws { + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._pose { + if let v = _pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.points.isEmpty { - try visitor.visitRepeatedMessageField(value: self.points, fieldNumber: 2) + } + if !points.isEmpty { + try visitor.visitRepeatedMessageField(value: points, fieldNumber: 2) } try { if let v = self._color { try visitor.visitSingularMessageField(value: v, fieldNumber: 3) } }() - if !self.colors.isEmpty { - try visitor.visitRepeatedMessageField(value: self.colors, fieldNumber: 4) + if !colors.isEmpty { + try visitor.visitRepeatedMessageField(value: colors, fieldNumber: 4) } - if !self.indices.isEmpty { - try visitor.visitPackedFixed32Field(value: self.indices, fieldNumber: 5) + if !indices.isEmpty { + try visitor.visitPackedFixed32Field(value: indices, fieldNumber: 5) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_TriangleListPrimitive, rhs: Foxglove_TriangleListPrimitive) -> Bool { - if lhs._pose != rhs._pose {return false} - if lhs.points != rhs.points {return false} - if lhs._color != rhs._color {return false} - if lhs.colors != rhs.colors {return false} - if lhs.indices != rhs.indices {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_TriangleListPrimitive, rhs: Foxglove_TriangleListPrimitive) -> Bool { + if lhs._pose != rhs._pose { return false } + if lhs.points != rhs.points { return false } + if lhs._color != rhs._color { return false } + if lhs.colors != rhs.colors { return false } + if lhs.indices != rhs.indices { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Vector2.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Vector2.pb.swift index dd39c02..7e92e60 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Vector2.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Vector2.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -40,47 +40,49 @@ struct Foxglove_Vector2 { } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_Vector2: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_Vector2: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_Vector2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_Vector2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".Vector2" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "x"), 2: .same(proto: "y"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularDoubleField(value: &self.x) }() - case 2: try { try decoder.decodeSingularDoubleField(value: &self.y) }() + case 1: try decoder.decodeSingularDoubleField(value: &x) + case 2: try decoder.decodeSingularDoubleField(value: &y) default: break } } } - func traverse(visitor: inout V) throws { - if self.x != 0 { - try visitor.visitSingularDoubleField(value: self.x, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if x != 0 { + try visitor.visitSingularDoubleField(value: x, fieldNumber: 1) } - if self.y != 0 { - try visitor.visitSingularDoubleField(value: self.y, fieldNumber: 2) + if y != 0 { + try visitor.visitSingularDoubleField(value: y, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_Vector2, rhs: Foxglove_Vector2) -> Bool { - if lhs.x != rhs.x {return false} - if lhs.y != rhs.y {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_Vector2, rhs: Foxglove_Vector2) -> Bool { + if lhs.x != rhs.x { return false } + if lhs.y != rhs.y { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Vector3.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Vector3.pb.swift index 488cc38..ed58be6 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Vector3.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Vector3.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -43,14 +43,16 @@ struct Foxglove_Vector3 { } #if swift(>=5.5) && canImport(_Concurrency) -extension Foxglove_Vector3: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) + extension Foxglove_Vector3: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -fileprivate let _protobuf_package = "foxglove" +private let _protobuf_package = "foxglove" -extension Foxglove_Vector3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Foxglove_Vector3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, + SwiftProtobuf._ProtoNameProviding +{ static let protoMessageName: String = _protobuf_package + ".Vector3" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "x"), @@ -58,38 +60,38 @@ extension Foxglove_Vector3: SwiftProtobuf.Message, SwiftProtobuf._MessageImpleme 3: .same(proto: "z"), ] - mutating func decodeMessage(decoder: inout D) throws { + mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularDoubleField(value: &self.x) }() - case 2: try { try decoder.decodeSingularDoubleField(value: &self.y) }() - case 3: try { try decoder.decodeSingularDoubleField(value: &self.z) }() + case 1: try decoder.decodeSingularDoubleField(value: &x) + case 2: try decoder.decodeSingularDoubleField(value: &y) + case 3: try decoder.decodeSingularDoubleField(value: &z) default: break } } } - func traverse(visitor: inout V) throws { - if self.x != 0 { - try visitor.visitSingularDoubleField(value: self.x, fieldNumber: 1) + func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + if x != 0 { + try visitor.visitSingularDoubleField(value: x, fieldNumber: 1) } - if self.y != 0 { - try visitor.visitSingularDoubleField(value: self.y, fieldNumber: 2) + if y != 0 { + try visitor.visitSingularDoubleField(value: y, fieldNumber: 2) } - if self.z != 0 { - try visitor.visitSingularDoubleField(value: self.z, fieldNumber: 3) + if z != 0 { + try visitor.visitSingularDoubleField(value: z, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func ==(lhs: Foxglove_Vector3, rhs: Foxglove_Vector3) -> Bool { - if lhs.x != rhs.x {return false} - if lhs.y != rhs.y {return false} - if lhs.z != rhs.z {return false} - if lhs.unknownFields != rhs.unknownFields {return false} + static func == (lhs: Foxglove_Vector3, rhs: Foxglove_Vector3) -> Bool { + if lhs.x != rhs.x { return false } + if lhs.y != rhs.y { return false } + if lhs.z != rhs.z { return false } + if lhs.unknownFields != rhs.unknownFields { return false } return true } } diff --git a/WebSocketDemo-Shared/Server.swift b/WebSocketDemo-Shared/Server.swift index 5830174..6251a85 100644 --- a/WebSocketDemo-Shared/Server.swift +++ b/WebSocketDemo-Shared/Server.swift @@ -1,11 +1,14 @@ -import SwiftUI -import CoreMotion import AVFoundation import Combine -import Network import CoreLocation +import CoreMotion +import Network +import SwiftUI import WatchConnectivity +// swiftlint:disable:next blanket_disable_command +// swiftlint:disable force_try + struct CPUUsage: Encodable, Identifiable { let usage: Double let date: Date @@ -30,6 +33,7 @@ struct Timestamp: Encodable { let sec: UInt32 let nsec: UInt32 } + extension Timestamp { init(_ date: Date) { let seconds = date.timeIntervalSince1970 @@ -43,6 +47,7 @@ extension Timestamp { nsec = intNsec } } + struct Health: Encodable { let heart_rate: Double let timestamp: Timestamp @@ -60,7 +65,7 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe @Published var actualPort: NWEndpoint.Port? let server = FoxgloveServer() - + let cameraManager = CameraManager() let motionManager = CMMotionManager() let locationManager = CLLocationManager() @@ -79,7 +84,7 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe let watchSession = WCSession.default @Published private(set) var droppedVideoFrames = 0 - + @Published private(set) var cameraError: Error? @Published var sendPose = true { @@ -101,11 +106,13 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe } } } + @Published var useVideoCompression = true { didSet { cameraManager.useVideoCompression = useVideoCompression } } + var hasCameraPermission: Bool { AVCaptureDevice.authorizationStatus(for: .video) == .authorized } @@ -119,8 +126,10 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe } } } + var hasLocationPermission: Bool { - locationManager.authorizationStatus == .authorizedWhenInUse || locationManager.authorizationStatus == .authorizedAlways + locationManager.authorizationStatus == .authorizedWhenInUse || locationManager + .authorizationStatus == .authorizedAlways } @Published var sendCPU = true { @@ -158,11 +167,9 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe cameraManager.activeCamera = activeCamera } } - - var clientEndpointNames: [String] { - return server.clientEndpointNames + server.clientEndpointNames } var cpuTimer: Timer? @@ -182,57 +189,61 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe topic: "camera_jpeg", encoding: "protobuf", schemaName: Foxglove_CompressedImage.protoMessageName, - schema: try! Data(contentsOf: Bundle(for: Self.self).url(forResource: "CompressedImage", withExtension: "bin")!).base64EncodedString() + schema: try! Data(contentsOf: Bundle(for: Self.self).url(forResource: "CompressedImage", withExtension: "bin")!) + .base64EncodedString() ) calibrationChannel = server.addChannel( topic: "calibration", encoding: "protobuf", schemaName: Foxglove_CameraCalibration.protoMessageName, - schema: try! Data(contentsOf: Bundle(for: Self.self).url(forResource: "CameraCalibration", withExtension: "bin")!).base64EncodedString() + schema: try! Data(contentsOf: Bundle(for: Self.self).url(forResource: "CameraCalibration", withExtension: "bin")!) + .base64EncodedString() ) h264Channel = server.addChannel( topic: "camera_h264", encoding: "protobuf", schemaName: Foxglove_CompressedVideo.protoMessageName, - schema: try! Data(contentsOf: Bundle(for: Self.self).url(forResource: "CompressedVideo", withExtension: "bin")!).base64EncodedString() + schema: try! Data(contentsOf: Bundle(for: Self.self).url(forResource: "CompressedVideo", withExtension: "bin")!) + .base64EncodedString() ) locationChannel = server.addChannel( topic: "gps", encoding: "protobuf", schemaName: Foxglove_LocationFix.protoMessageName, - schema: try! Data(contentsOf: Bundle(for: Self.self).url(forResource: "LocationFix", withExtension: "bin")!).base64EncodedString() + schema: try! Data(contentsOf: Bundle(for: Self.self).url(forResource: "LocationFix", withExtension: "bin")!) + .base64EncodedString() ) cpuChannel = server.addChannel(topic: "cpu", encoding: "json", schemaName: "CPU", schema: -#""" -{ - "type":"object", - "properties":{ - "usage":{"type":"number"} - } -} -"""#) + #""" + { + "type":"object", + "properties":{ + "usage":{"type":"number"} + } + } + """#) memChannel = server.addChannel(topic: "memory", encoding: "json", schemaName: "Memory", schema: -#""" -{ - "type":"object", - "properties":{ - "usage":{"type":"number"} - } -} -"""#) + #""" + { + "type":"object", + "properties":{ + "usage":{"type":"number"} + } + } + """#) healthChannel = server.addChannel(topic: "health", encoding: "json", schemaName: "Health", schema: -#""" -{ - "type":"object", - "properties":{ - "heart_rate":{"type":"number"}, - "timestamp":{ - "type":"object", - "properties":{"sec":{"type":"number"},"nsec":{"type":"number"}} - } - } -} -"""#) + #""" + { + "type":"object", + "properties":{ + "heart_rate":{"type":"number"}, + "timestamp":{ + "type":"object", + "properties":{"sec":{"type":"number"},"nsec":{"type":"number"}} + } + } + } + """#) super.init() server.start(preferredPort: preferredPort.flatMap { UInt16(exactly: $0) }) server.$port @@ -246,11 +257,11 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe startCPUUpdates() startMemoryUpdates() watchSession.delegate = self - + cameraManager.$droppedFrames .assign(to: \.droppedVideoFrames, on: self) .store(in: &subscribers) - + cameraManager.$currentError .assign(to: \.cameraError, on: self) .store(in: &subscribers) @@ -264,7 +275,7 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe msg.timestamp = .init(date: .now) msg.frameID = "camera" // Convert column-major to row-major - msg.k = (0..<3).flatMap { r in (0..<3).map { c in Double(calibration.intrinsicMatrix[c, r]) } } + msg.k = (0 ..< 3).flatMap { r in (0 ..< 3).map { c in Double(calibration.intrinsicMatrix[c, r]) } } msg.p = [ msg.k[0], msg.k[1], msg.k[2], 0, msg.k[3], msg.k[4], msg.k[5], 0, @@ -273,7 +284,7 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe msg.width = UInt32(calibration.width) msg.height = UInt32(calibration.height) let data = try! msg.serializedData() - self.server.sendMessage(on: self.calibrationChannel, timestamp: DispatchTime.now().uptimeNanoseconds, payload: data) + server.sendMessage(on: calibrationChannel, timestamp: DispatchTime.now().uptimeNanoseconds, payload: data) } .store(in: &subscribers) @@ -288,7 +299,7 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe msg.format = "jpeg" msg.data = $0 let data = try! msg.serializedData() - self.server.sendMessage(on: self.jpegChannel, timestamp: DispatchTime.now().uptimeNanoseconds, payload: data) + server.sendMessage(on: jpegChannel, timestamp: DispatchTime.now().uptimeNanoseconds, payload: data) } .store(in: &subscribers) @@ -303,7 +314,7 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe msg.format = "h264" msg.data = $0 let data = try! msg.serializedData() - self.server.sendMessage(on: self.h264Channel, timestamp: DispatchTime.now().uptimeNanoseconds, payload: data) + server.sendMessage(on: h264Channel, timestamp: DispatchTime.now().uptimeNanoseconds, payload: data) } .store(in: &subscribers) @@ -317,7 +328,7 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe } func updateAddresses() { - self.addresses = getIPAddresses() + addresses = getIPAddresses() .filter { // Filter out some AirDrop interfaces that are not useful https://apple.stackexchange.com/q/394047/8318 if $0.interface?.name.hasPrefix("llw") == true || $0.interface?.name.hasPrefix("awdl") == true { @@ -389,7 +400,6 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe memTimer = nil } - func startLocationUpdates() { locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyBest @@ -403,7 +413,7 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe locationManager.stopUpdatingLocation() } - nonisolated func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { + nonisolated func locationManager(_: CLLocationManager, didUpdateLocations locations: [CLLocation]) { guard let location: CLLocation = locations.last else { return } var msg = Foxglove_LocationFix() @@ -425,27 +435,28 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe func startPoseUpdates() { motionManager.deviceMotionUpdateInterval = 0.02 - motionManager.startDeviceMotionUpdates(to: .main) { motion, error in + motionManager.startDeviceMotionUpdates(to: .main) { motion, _ in if let motion { self.sendPose(motion: motion) } } } + func stopPoseUpdates() { motionManager.stopDeviceMotionUpdates() } func sendPose(motion: CMDeviceMotion) { let data = try! JSONSerialization.data(withJSONObject: [ - "timestamp": ["sec":0,"nsec":0], + "timestamp": ["sec": 0, "nsec": 0], "frame_id": "root", "pose": [ - "position":["x":0,"y":0,"z":0], - "orientation":[ - "x":motion.attitude.quaternion.x, - "y":motion.attitude.quaternion.y, - "z":motion.attitude.quaternion.z, - "w":motion.attitude.quaternion.w, + "position": ["x": 0, "y": 0, "z": 0], + "orientation": [ + "x": motion.attitude.quaternion.x, + "y": motion.attitude.quaternion.y, + "z": motion.attitude.quaternion.z, + "w": motion.attitude.quaternion.w, ], ], ], options: .sortedKeys) @@ -454,28 +465,28 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe } } - extension Server: WCSessionDelegate { - func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) { + func session(_: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) { print("watch activation completed: \(activationState), error: \(error)") } - func sessionDidBecomeInactive(_ session: WCSession) { + func sessionDidBecomeInactive(_: WCSession) { print("watch became inactive") } - func sessionDidDeactivate(_ session: WCSession) { + func sessionDidDeactivate(_: WCSession) { print("watch deactivated") } func startWatchUpdates() { watchSession.activate() } + func stopWatchUpdates() { print("stop watch updates?") } - func session(_ session: WCSession, didReceiveMessage message: [String : Any]) { + func session(_: WCSession, didReceiveMessage message: [String: Any]) { print("message from watch: \(message)") guard sendWatchData else { return diff --git a/WebSocketDemo-Shared/compareIPAddresses.swift b/WebSocketDemo-Shared/compareIPAddresses.swift index f03eba2..e06ba69 100644 --- a/WebSocketDemo-Shared/compareIPAddresses.swift +++ b/WebSocketDemo-Shared/compareIPAddresses.swift @@ -1,9 +1,9 @@ import Foundation import Network -fileprivate struct BytewiseLess: Comparable { +private struct BytewiseLess: Comparable { let data: Data - static func <(lhs: BytewiseLess, rhs: BytewiseLess) -> Bool { + static func < (lhs: BytewiseLess, rhs: BytewiseLess) -> Bool { if lhs.data.count < rhs.data.count { return true } @@ -18,10 +18,10 @@ fileprivate struct BytewiseLess: Comparable { } } -fileprivate struct TrueLess: Comparable { +private struct TrueLess: Comparable { let value: Bool - static func <(lhs: TrueLess, rhs: TrueLess) -> Bool { - return lhs.value && !rhs.value + static func < (lhs: TrueLess, rhs: TrueLess) -> Bool { + lhs.value && !rhs.value } } @@ -32,7 +32,7 @@ fileprivate struct TrueLess: Comparable { - fall back to comparing raw addresses */ func compareIPAddresses(_ lhs: IPAddress, _ rhs: IPAddress) -> Bool { - return ( + ( TrueLess(value: lhs is IPv4Address), TrueLess(value: lhs.interface?.type == .wifi), TrueLess(value: lhs.interface?.type == .wiredEthernet), diff --git a/WebSocketDemo-Shared/getCPUUsage.swift b/WebSocketDemo-Shared/getCPUUsage.swift index 51fd1b9..c5d062d 100644 --- a/WebSocketDemo-Shared/getCPUUsage.swift +++ b/WebSocketDemo-Shared/getCPUUsage.swift @@ -1,7 +1,7 @@ import Darwin.Mach.host_info //// https://stackoverflow.com/a/44744883 -//func getCPUUsage() -> host_cpu_load_info? { +// func getCPUUsage() -> host_cpu_load_info? { // let HOST_CPU_LOAD_INFO_COUNT = MemoryLayout.stride / MemoryLayout.stride // // var size = mach_msg_type_number_t(HOST_CPU_LOAD_INFO_COUNT) @@ -18,22 +18,23 @@ import Darwin.Mach.host_info // let data = hostInfo.move() // hostInfo.deallocate() // return data -//} +// } +// swiftlint:disable:next line_length // From https://github.com/dani-gavrilov/GDPerformanceView-Swift/blob/171a656040135d667f4228c3ec82f2384770d87d/GDPerformanceView-Swift/GDPerformanceMonitoring/PerformanceСalculator.swift#L94 // See also: https://developer.apple.com/forums/thread/655349 func getCPUUsage() -> Double { - var totalUsageOfCPU: Double = 0.0 + var totalUsageOfCPU = 0.0 var threadsList: thread_act_array_t? var threadsCount = mach_msg_type_number_t(0) let threadsResult = withUnsafeMutablePointer(to: &threadsList) { - return $0.withMemoryRebound(to: thread_act_array_t?.self, capacity: 1) { + $0.withMemoryRebound(to: thread_act_array_t?.self, capacity: 1) { task_threads(mach_task_self_, $0, &threadsCount) } } - if threadsResult == KERN_SUCCESS, let threadsList = threadsList { - for index in 0.. Double { } } - vm_deallocate(mach_task_self_, vm_address_t(UInt(bitPattern: threadsList)), vm_size_t(Int(threadsCount) * MemoryLayout.stride)) + vm_deallocate( + mach_task_self_, + vm_address_t(UInt(bitPattern: threadsList)), + vm_size_t(Int(threadsCount) * MemoryLayout.stride) + ) return totalUsageOfCPU } diff --git a/WebSocketDemo-Shared/getMemoryUsage.swift b/WebSocketDemo-Shared/getMemoryUsage.swift index 0521dc3..8ba0df9 100644 --- a/WebSocketDemo-Shared/getMemoryUsage.swift +++ b/WebSocketDemo-Shared/getMemoryUsage.swift @@ -1,6 +1,7 @@ -import Foundation import Darwin.Mach.task_info +import Foundation +// swiftlint:disable:next line_length // https://github.com/dani-gavrilov/GDPerformanceView-Swift/blob/171a656040135d667f4228c3ec82f2384770d87d/GDPerformanceView-Swift/GDPerformanceMonitoring/PerformanceСalculator.swift#L129 func getMemoryUsage() -> (used: UInt64, total: UInt64) { var taskInfo = task_vm_info_data_t() diff --git a/WebSocketDemo-Shared/schemas.swift b/WebSocketDemo-Shared/schemas.swift index 3b1195a..b997e48 100644 --- a/WebSocketDemo-Shared/schemas.swift +++ b/WebSocketDemo-Shared/schemas.swift @@ -1,3 +1,6 @@ +// swiftlint:disable:next blanket_disable_command +// swiftlint:disable line_length + let poseInFrameSchema = """ { "title": "foxglove.PoseInFrame", diff --git a/WebSocketDemo-Watch/ContentView.swift b/WebSocketDemo-Watch/ContentView.swift index b83e96a..fffaef5 100644 --- a/WebSocketDemo-Watch/ContentView.swift +++ b/WebSocketDemo-Watch/ContentView.swift @@ -1,6 +1,6 @@ +import HealthKit import SwiftUI import WatchConnectivity -import HealthKit @MainActor class SessionManager: NSObject, ObservableObject, WCSessionDelegate { @@ -34,7 +34,11 @@ class SessionManager: NSObject, ObservableObject, WCSessionDelegate { } } - nonisolated func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) { + nonisolated func session( + _: WCSession, + activationDidCompleteWith activationState: WCSessionActivationState, + error: Error? + ) { guard activationState == .activated else { print("activation failed \(error)") return @@ -61,21 +65,26 @@ class SessionManager: NSObject, ObservableObject, WCSessionDelegate { session.pause() workoutSession = session print("started session") - } catch let error { + } catch { print("error creating workout: \(error)") } let type = HKQuantityType(.heartRate) - let query = HKAnchoredObjectQuery(type: type, predicate: HKQuery.predicateForSamples(withStart: .now, end: nil), anchor: nil, limit: HKObjectQueryNoLimit) { query, samples, deleted, anchor, error in + let query = HKAnchoredObjectQuery( + type: type, + predicate: HKQuery.predicateForSamples(withStart: .now, end: nil), + anchor: nil, + limit: HKObjectQueryNoLimit + ) { _, samples, deleted, anchor, error in print("results: \(samples), deleted \(deleted), anchor \(anchor), error \(error)") } - query.updateHandler = { [weak self] query, samples, deleted, anchor, error in + query.updateHandler = { [weak self] _, samples, deleted, anchor, error in guard let self else { return } print("update: \(samples), deleted \(deleted), anchor \(anchor), error \(error)") guard let samples else { return } for case let sample as HKQuantitySample in samples { let bpm = sample.quantity.doubleValue(for: HKUnit(from: "count/min")) - self.session.sendMessage(["heart_rate": bpm], replyHandler: nil) + session.sendMessage(["heart_rate": bpm], replyHandler: nil) Task { @MainActor in self.currentHeartRate = bpm } From 04bea655e0e9501f52fbe7cef66a8820019fd4fa Mon Sep 17 00:00:00 2001 From: Jacob Bandes-Storch Date: Fri, 27 Oct 2023 16:18:28 -0500 Subject: [PATCH 2/7] undo format changes to .pb.swift files --- .swiftformat | 1 + .../Schemas/foxglove/ArrowPrimitive.pb.swift | 89 +++++----- .../foxglove/CameraCalibration.pb.swift | 156 ++++++++--------- .../foxglove/CircleAnnotation.pb.swift | 100 +++++------ .../Schemas/foxglove/Color.pb.swift | 52 +++--- .../Schemas/foxglove/CompressedImage.pb.swift | 74 ++++---- .../Schemas/foxglove/CompressedVideo.pb.swift | 78 ++++----- .../Schemas/foxglove/CubePrimitive.pb.swift | 69 ++++---- .../foxglove/CylinderPrimitive.pb.swift | 88 +++++----- .../Schemas/foxglove/FrameTransform.pb.swift | 89 +++++----- .../Schemas/foxglove/FrameTransforms.pb.swift | 28 ++- .../Schemas/foxglove/GeoJSON.pb.swift | 30 ++-- .../Schemas/foxglove/Grid.pb.swift | 129 +++++++------- .../foxglove/ImageAnnotations.pb.swift | 44 +++-- .../Schemas/foxglove/KeyValuePair.pb.swift | 40 ++--- .../Schemas/foxglove/LaserScan.pb.swift | 99 +++++------ .../Schemas/foxglove/LinePrimitive.pb.swift | 147 ++++++++-------- .../Schemas/foxglove/LocationFix.pb.swift | 121 +++++++------ .../Schemas/foxglove/Log.pb.swift | 126 +++++++------- .../Schemas/foxglove/ModelPrimitive.pb.swift | 119 ++++++------- .../foxglove/PackedElementField.pb.swift | 99 ++++++----- .../Schemas/foxglove/Point2.pb.swift | 36 ++-- .../Schemas/foxglove/Point3.pb.swift | 44 +++-- .../Schemas/foxglove/PointCloud.pb.swift | 96 +++++------ .../foxglove/PointsAnnotation.pb.swift | 138 +++++++-------- .../Schemas/foxglove/Pose.pb.swift | 54 +++--- .../Schemas/foxglove/PoseInFrame.pb.swift | 64 ++++--- .../Schemas/foxglove/PosesInFrame.pb.swift | 57 +++--- .../Schemas/foxglove/Quaternion.pb.swift | 52 +++--- .../Schemas/foxglove/RawImage.pb.swift | 101 ++++++----- .../Schemas/foxglove/SceneEntity.pb.swift | 163 +++++++++--------- .../foxglove/SceneEntityDeletion.pb.swift | 82 +++++---- .../Schemas/foxglove/SceneUpdate.pb.swift | 36 ++-- .../Schemas/foxglove/SpherePrimitive.pb.swift | 69 ++++---- .../Schemas/foxglove/TextAnnotation.pb.swift | 102 ++++++----- .../Schemas/foxglove/TextPrimitive.pb.swift | 94 +++++----- .../foxglove/TriangleListPrimitive.pb.swift | 86 +++++---- .../Schemas/foxglove/Vector2.pb.swift | 36 ++-- .../Schemas/foxglove/Vector3.pb.swift | 44 +++-- 39 files changed, 1482 insertions(+), 1650 deletions(-) diff --git a/.swiftformat b/.swiftformat index 1e21ac0..064eb11 100644 --- a/.swiftformat +++ b/.swiftformat @@ -1,3 +1,4 @@ --swiftversion 5.9 --indent 2 --maxwidth 120 +--exclude WebSocketDemo-Shared/Schemas/foxglove diff --git a/WebSocketDemo-Shared/Schemas/foxglove/ArrowPrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/ArrowPrimitive.pb.swift index dda4595..cb2db91 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/ArrowPrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/ArrowPrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -28,17 +28,15 @@ struct Foxglove_ArrowPrimitive { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - /// Position of the arrow's tail and orientation of the arrow. Identity orientation means the arrow points in the +x - /// direction. + /// Position of the arrow's tail and orientation of the arrow. Identity orientation means the arrow points in the +x direction. var pose: Foxglove_Pose { - get { _pose ?? Foxglove_Pose() } - set { _pose = newValue } + get {return _pose ?? Foxglove_Pose()} + set {_pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _pose != nil } + var hasPose: Bool {return self._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _pose = nil } + mutating func clearPose() {self._pose = nil} /// Length of the arrow shaft var shaftLength: Double = 0 @@ -54,34 +52,31 @@ struct Foxglove_ArrowPrimitive { /// Color of the arrow var color: Foxglove_Color { - get { _color ?? Foxglove_Color() } - set { _color = newValue } + get {return _color ?? Foxglove_Color()} + set {_color = newValue} } - /// Returns true if `color` has been explicitly set. - var hasColor: Bool { _color != nil } + var hasColor: Bool {return self._color != nil} /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() { _color = nil } + mutating func clearColor() {self._color = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _pose: Foxglove_Pose? - private var _color: Foxglove_Color? + fileprivate var _pose: Foxglove_Pose? = nil + fileprivate var _color: Foxglove_Color? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_ArrowPrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_ArrowPrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_ArrowPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_ArrowPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ArrowPrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -92,42 +87,42 @@ extension Foxglove_ArrowPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message 6: .same(proto: "color"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_pose) - case 2: try decoder.decodeSingularDoubleField(value: &shaftLength) - case 3: try decoder.decodeSingularDoubleField(value: &shaftDiameter) - case 4: try decoder.decodeSingularDoubleField(value: &headLength) - case 5: try decoder.decodeSingularDoubleField(value: &headDiameter) - case 6: try decoder.decodeSingularMessageField(value: &_color) + case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.shaftLength) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.shaftDiameter) }() + case 4: try { try decoder.decodeSingularDoubleField(value: &self.headLength) }() + case 5: try { try decoder.decodeSingularDoubleField(value: &self.headDiameter) }() + case 6: try { try decoder.decodeSingularMessageField(value: &self._color) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _pose { + try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.shaftLength != 0 { + try visitor.visitSingularDoubleField(value: self.shaftLength, fieldNumber: 2) } - if shaftLength != 0 { - try visitor.visitSingularDoubleField(value: shaftLength, fieldNumber: 2) - } - if shaftDiameter != 0 { - try visitor.visitSingularDoubleField(value: shaftDiameter, fieldNumber: 3) + if self.shaftDiameter != 0 { + try visitor.visitSingularDoubleField(value: self.shaftDiameter, fieldNumber: 3) } - if headLength != 0 { - try visitor.visitSingularDoubleField(value: headLength, fieldNumber: 4) + if self.headLength != 0 { + try visitor.visitSingularDoubleField(value: self.headLength, fieldNumber: 4) } - if headDiameter != 0 { - try visitor.visitSingularDoubleField(value: headDiameter, fieldNumber: 5) + if self.headDiameter != 0 { + try visitor.visitSingularDoubleField(value: self.headDiameter, fieldNumber: 5) } try { if let v = self._color { try visitor.visitSingularMessageField(value: v, fieldNumber: 6) @@ -135,14 +130,14 @@ extension Foxglove_ArrowPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_ArrowPrimitive, rhs: Foxglove_ArrowPrimitive) -> Bool { - if lhs._pose != rhs._pose { return false } - if lhs.shaftLength != rhs.shaftLength { return false } - if lhs.shaftDiameter != rhs.shaftDiameter { return false } - if lhs.headLength != rhs.headLength { return false } - if lhs.headDiameter != rhs.headDiameter { return false } - if lhs._color != rhs._color { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_ArrowPrimitive, rhs: Foxglove_ArrowPrimitive) -> Bool { + if lhs._pose != rhs._pose {return false} + if lhs.shaftLength != rhs.shaftLength {return false} + if lhs.shaftDiameter != rhs.shaftDiameter {return false} + if lhs.headLength != rhs.headLength {return false} + if lhs.headDiameter != rhs.headDiameter {return false} + if lhs._color != rhs._color {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CameraCalibration.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CameraCalibration.pb.swift index fa50305..9ebecdc 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CameraCalibration.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CameraCalibration.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,18 +30,16 @@ struct Foxglove_CameraCalibration { /// Timestamp of calibration data var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} - /// Frame of reference for the camera. The origin of the frame is the optical center of the camera. +x points to the - /// right in the image, +y points down, and +z points into the plane of the image. - var frameID: String = .init() + /// Frame of reference for the camera. The origin of the frame is the optical center of the camera. +x points to the right in the image, +y points down, and +z points into the plane of the image. + var frameID: String = String() /// Image width var width: UInt32 = 0 @@ -50,20 +48,19 @@ struct Foxglove_CameraCalibration { var height: UInt32 = 0 /// Name of distortion model - /// + /// /// Supported values: `plumb_bob` and `rational_polynomial` - var distortionModel: String = .init() + var distortionModel: String = String() /// Distortion parameters var d: [Double] = [] /// Intrinsic camera matrix (3x3 row-major matrix) - /// + /// /// A 3x3 row-major matrix for the raw (distorted) image. - /// - /// Projects 3D points in the camera coordinate frame to 2D pixel coordinates using the focal lengths (fx, fy) and - /// principal point (cx, cy). - /// + /// + /// Projects 3D points in the camera coordinate frame to 2D pixel coordinates using the focal lengths (fx, fy) and principal point (cx, cy). + /// /// ``` /// [fx 0 cx] /// K = [ 0 fy cy] @@ -72,41 +69,34 @@ struct Foxglove_CameraCalibration { var k: [Double] = [] /// Rectification matrix (stereo cameras only, 3x3 row-major matrix) - /// - /// A rotation matrix aligning the camera coordinate system to the ideal stereo image plane so that epipolar lines in - /// both stereo images are parallel. + /// + /// A rotation matrix aligning the camera coordinate system to the ideal stereo image plane so that epipolar lines in both stereo images are parallel. var r: [Double] = [] /// Projection/camera matrix (3x4 row-major matrix) - /// + /// /// ``` /// [fx' 0 cx' Tx] /// P = [ 0 fy' cy' Ty] /// [ 0 0 1 0] /// ``` - /// - /// By convention, this matrix specifies the intrinsic (camera) matrix of the processed (rectified) image. That is, - /// the left 3x3 portion is the normal camera intrinsic matrix for the rectified image. - /// - /// It projects 3D points in the camera coordinate frame to 2D pixel coordinates using the focal lengths (fx', fy') - /// and principal point (cx', cy') - these may differ from the values in K. - /// - /// For monocular cameras, Tx = Ty = 0. Normally, monocular cameras will also have R = the identity and P[1:3,1:3] = - /// K. - /// - /// For a stereo pair, the fourth column [Tx Ty 0]' is related to the position of the optical center of the second - /// camera in the first camera's frame. We assume Tz = 0 so both cameras are in the same stereo image plane. The first - /// camera always has Tx = Ty = 0. For the right (second) camera of a horizontal stereo pair, Ty = 0 and Tx = -fx' * - /// B, where B is the baseline between the cameras. - /// + /// + /// By convention, this matrix specifies the intrinsic (camera) matrix of the processed (rectified) image. That is, the left 3x3 portion is the normal camera intrinsic matrix for the rectified image. + /// + /// It projects 3D points in the camera coordinate frame to 2D pixel coordinates using the focal lengths (fx', fy') and principal point (cx', cy') - these may differ from the values in K. + /// + /// For monocular cameras, Tx = Ty = 0. Normally, monocular cameras will also have R = the identity and P[1:3,1:3] = K. + /// + /// For a stereo pair, the fourth column [Tx Ty 0]' is related to the position of the optical center of the second camera in the first camera's frame. We assume Tz = 0 so both cameras are in the same stereo image plane. The first camera always has Tx = Ty = 0. For the right (second) camera of a horizontal stereo pair, Ty = 0 and Tx = -fx' * B, where B is the baseline between the cameras. + /// /// Given a 3D point [X Y Z]', the projection (x, y) of the point onto the rectified image is given by: - /// + /// /// ``` /// [u v w]' = P * [X Y Z 1]' /// x = u / w /// y = v / w /// ``` - /// + /// /// This holds for both images of a stereo pair. var p: [Double] = [] @@ -114,20 +104,18 @@ struct Foxglove_CameraCalibration { init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_CameraCalibration: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_CameraCalibration: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_CameraCalibration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_CameraCalibration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".CameraCalibration" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -141,72 +129,72 @@ extension Foxglove_CameraCalibration: SwiftProtobuf.Message, SwiftProtobuf._Mess 8: .same(proto: "P"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularFixed32Field(value: &width) - case 3: try decoder.decodeSingularFixed32Field(value: &height) - case 4: try decoder.decodeSingularStringField(value: &distortionModel) - case 5: try decoder.decodeRepeatedDoubleField(value: &d) - case 6: try decoder.decodeRepeatedDoubleField(value: &k) - case 7: try decoder.decodeRepeatedDoubleField(value: &r) - case 8: try decoder.decodeRepeatedDoubleField(value: &p) - case 9: try decoder.decodeSingularStringField(value: &frameID) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularFixed32Field(value: &self.width) }() + case 3: try { try decoder.decodeSingularFixed32Field(value: &self.height) }() + case 4: try { try decoder.decodeSingularStringField(value: &self.distortionModel) }() + case 5: try { try decoder.decodeRepeatedDoubleField(value: &self.d) }() + case 6: try { try decoder.decodeRepeatedDoubleField(value: &self.k) }() + case 7: try { try decoder.decodeRepeatedDoubleField(value: &self.r) }() + case 8: try { try decoder.decodeRepeatedDoubleField(value: &self.p) }() + case 9: try { try decoder.decodeSingularStringField(value: &self.frameID) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.width != 0 { + try visitor.visitSingularFixed32Field(value: self.width, fieldNumber: 2) } - if width != 0 { - try visitor.visitSingularFixed32Field(value: width, fieldNumber: 2) - } - if height != 0 { - try visitor.visitSingularFixed32Field(value: height, fieldNumber: 3) + if self.height != 0 { + try visitor.visitSingularFixed32Field(value: self.height, fieldNumber: 3) } - if !distortionModel.isEmpty { - try visitor.visitSingularStringField(value: distortionModel, fieldNumber: 4) + if !self.distortionModel.isEmpty { + try visitor.visitSingularStringField(value: self.distortionModel, fieldNumber: 4) } - if !d.isEmpty { - try visitor.visitPackedDoubleField(value: d, fieldNumber: 5) + if !self.d.isEmpty { + try visitor.visitPackedDoubleField(value: self.d, fieldNumber: 5) } - if !k.isEmpty { - try visitor.visitPackedDoubleField(value: k, fieldNumber: 6) + if !self.k.isEmpty { + try visitor.visitPackedDoubleField(value: self.k, fieldNumber: 6) } - if !r.isEmpty { - try visitor.visitPackedDoubleField(value: r, fieldNumber: 7) + if !self.r.isEmpty { + try visitor.visitPackedDoubleField(value: self.r, fieldNumber: 7) } - if !p.isEmpty { - try visitor.visitPackedDoubleField(value: p, fieldNumber: 8) + if !self.p.isEmpty { + try visitor.visitPackedDoubleField(value: self.p, fieldNumber: 8) } - if !frameID.isEmpty { - try visitor.visitSingularStringField(value: frameID, fieldNumber: 9) + if !self.frameID.isEmpty { + try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 9) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_CameraCalibration, rhs: Foxglove_CameraCalibration) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.frameID != rhs.frameID { return false } - if lhs.width != rhs.width { return false } - if lhs.height != rhs.height { return false } - if lhs.distortionModel != rhs.distortionModel { return false } - if lhs.d != rhs.d { return false } - if lhs.k != rhs.k { return false } - if lhs.r != rhs.r { return false } - if lhs.p != rhs.p { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_CameraCalibration, rhs: Foxglove_CameraCalibration) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.frameID != rhs.frameID {return false} + if lhs.width != rhs.width {return false} + if lhs.height != rhs.height {return false} + if lhs.distortionModel != rhs.distortionModel {return false} + if lhs.d != rhs.d {return false} + if lhs.k != rhs.k {return false} + if lhs.r != rhs.r {return false} + if lhs.p != rhs.p {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CircleAnnotation.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CircleAnnotation.pb.swift index aecc294..2ed930c 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CircleAnnotation.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CircleAnnotation.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,25 +30,23 @@ struct Foxglove_CircleAnnotation { /// Timestamp of circle var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Center of the circle in 2D image coordinates (pixels) var position: Foxglove_Point2 { - get { _position ?? Foxglove_Point2() } - set { _position = newValue } + get {return _position ?? Foxglove_Point2()} + set {_position = newValue} } - /// Returns true if `position` has been explicitly set. - var hasPosition: Bool { _position != nil } + var hasPosition: Bool {return self._position != nil} /// Clears the value of `position`. Subsequent reads from it will return its default value. - mutating func clearPosition() { _position = nil } + mutating func clearPosition() {self._position = nil} /// Circle diameter in pixels var diameter: Double = 0 @@ -58,47 +56,43 @@ struct Foxglove_CircleAnnotation { /// Fill color var fillColor: Foxglove_Color { - get { _fillColor ?? Foxglove_Color() } - set { _fillColor = newValue } + get {return _fillColor ?? Foxglove_Color()} + set {_fillColor = newValue} } - /// Returns true if `fillColor` has been explicitly set. - var hasFillColor: Bool { _fillColor != nil } + var hasFillColor: Bool {return self._fillColor != nil} /// Clears the value of `fillColor`. Subsequent reads from it will return its default value. - mutating func clearFillColor() { _fillColor = nil } + mutating func clearFillColor() {self._fillColor = nil} /// Outline color var outlineColor: Foxglove_Color { - get { _outlineColor ?? Foxglove_Color() } - set { _outlineColor = newValue } + get {return _outlineColor ?? Foxglove_Color()} + set {_outlineColor = newValue} } - /// Returns true if `outlineColor` has been explicitly set. - var hasOutlineColor: Bool { _outlineColor != nil } + var hasOutlineColor: Bool {return self._outlineColor != nil} /// Clears the value of `outlineColor`. Subsequent reads from it will return its default value. - mutating func clearOutlineColor() { _outlineColor = nil } + mutating func clearOutlineColor() {self._outlineColor = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? - private var _position: Foxglove_Point2? - private var _fillColor: Foxglove_Color? - private var _outlineColor: Foxglove_Color? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + fileprivate var _position: Foxglove_Point2? = nil + fileprivate var _fillColor: Foxglove_Color? = nil + fileprivate var _outlineColor: Foxglove_Color? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_CircleAnnotation: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_CircleAnnotation: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_CircleAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_CircleAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".CircleAnnotation" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -109,39 +103,39 @@ extension Foxglove_CircleAnnotation: SwiftProtobuf.Message, SwiftProtobuf._Messa 6: .standard(proto: "outline_color"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularMessageField(value: &_position) - case 3: try decoder.decodeSingularDoubleField(value: &diameter) - case 4: try decoder.decodeSingularDoubleField(value: &thickness) - case 5: try decoder.decodeSingularMessageField(value: &_fillColor) - case 6: try decoder.decodeSingularMessageField(value: &_outlineColor) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._position) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.diameter) }() + case 4: try { try decoder.decodeSingularDoubleField(value: &self.thickness) }() + case 5: try { try decoder.decodeSingularMessageField(value: &self._fillColor) }() + case 6: try { try decoder.decodeSingularMessageField(value: &self._outlineColor) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } + } }() try { if let v = self._position { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() - if diameter != 0 { - try visitor.visitSingularDoubleField(value: diameter, fieldNumber: 3) + if self.diameter != 0 { + try visitor.visitSingularDoubleField(value: self.diameter, fieldNumber: 3) } - if thickness != 0 { - try visitor.visitSingularDoubleField(value: thickness, fieldNumber: 4) + if self.thickness != 0 { + try visitor.visitSingularDoubleField(value: self.thickness, fieldNumber: 4) } try { if let v = self._fillColor { try visitor.visitSingularMessageField(value: v, fieldNumber: 5) @@ -152,14 +146,14 @@ extension Foxglove_CircleAnnotation: SwiftProtobuf.Message, SwiftProtobuf._Messa try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_CircleAnnotation, rhs: Foxglove_CircleAnnotation) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs._position != rhs._position { return false } - if lhs.diameter != rhs.diameter { return false } - if lhs.thickness != rhs.thickness { return false } - if lhs._fillColor != rhs._fillColor { return false } - if lhs._outlineColor != rhs._outlineColor { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_CircleAnnotation, rhs: Foxglove_CircleAnnotation) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs._position != rhs._position {return false} + if lhs.diameter != rhs.diameter {return false} + if lhs.thickness != rhs.thickness {return false} + if lhs._fillColor != rhs._fillColor {return false} + if lhs._outlineColor != rhs._outlineColor {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Color.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Color.pb.swift index c00709f..79b6e07 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Color.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Color.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -46,16 +46,14 @@ struct Foxglove_Color { } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_Color: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_Color: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_Color: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_Color: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Color" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "r"), @@ -64,43 +62,43 @@ extension Foxglove_Color: SwiftProtobuf.Message, SwiftProtobuf._MessageImplement 4: .same(proto: "a"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularDoubleField(value: &r) - case 2: try decoder.decodeSingularDoubleField(value: &g) - case 3: try decoder.decodeSingularDoubleField(value: &b) - case 4: try decoder.decodeSingularDoubleField(value: &a) + case 1: try { try decoder.decodeSingularDoubleField(value: &self.r) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.g) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.b) }() + case 4: try { try decoder.decodeSingularDoubleField(value: &self.a) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if r != 0 { - try visitor.visitSingularDoubleField(value: r, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if self.r != 0 { + try visitor.visitSingularDoubleField(value: self.r, fieldNumber: 1) } - if g != 0 { - try visitor.visitSingularDoubleField(value: g, fieldNumber: 2) + if self.g != 0 { + try visitor.visitSingularDoubleField(value: self.g, fieldNumber: 2) } - if b != 0 { - try visitor.visitSingularDoubleField(value: b, fieldNumber: 3) + if self.b != 0 { + try visitor.visitSingularDoubleField(value: self.b, fieldNumber: 3) } - if a != 0 { - try visitor.visitSingularDoubleField(value: a, fieldNumber: 4) + if self.a != 0 { + try visitor.visitSingularDoubleField(value: self.a, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_Color, rhs: Foxglove_Color) -> Bool { - if lhs.r != rhs.r { return false } - if lhs.g != rhs.g { return false } - if lhs.b != rhs.b { return false } - if lhs.a != rhs.a { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_Color, rhs: Foxglove_Color) -> Bool { + if lhs.r != rhs.r {return false} + if lhs.g != rhs.g {return false} + if lhs.b != rhs.b {return false} + if lhs.a != rhs.a {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CompressedImage.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CompressedImage.pb.swift index f77770d..8db00e2 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CompressedImage.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CompressedImage.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,45 +30,41 @@ struct Foxglove_CompressedImage { /// Timestamp of image var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} - /// Frame of reference for the image. The origin of the frame is the optical center of the camera. +x points to the - /// right in the image, +y points down, and +z points into the plane of the image. - var frameID: String = .init() + /// Frame of reference for the image. The origin of the frame is the optical center of the camera. +x points to the right in the image, +y points down, and +z points into the plane of the image. + var frameID: String = String() /// Compressed image data - var data: Data = .init() + var data: Data = Data() /// Image format - /// + /// /// Supported values: image media types supported by Chrome, such as `webp`, `jpeg`, `png` - var format: String = .init() + var format: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_CompressedImage: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_CompressedImage: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_CompressedImage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_CompressedImage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".CompressedImage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -77,47 +73,47 @@ extension Foxglove_CompressedImage: SwiftProtobuf.Message, SwiftProtobuf._Messag 3: .same(proto: "format"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularBytesField(value: &data) - case 3: try decoder.decodeSingularStringField(value: &format) - case 4: try decoder.decodeSingularStringField(value: &frameID) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.data) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.format) }() + case 4: try { try decoder.decodeSingularStringField(value: &self.frameID) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.data.isEmpty { + try visitor.visitSingularBytesField(value: self.data, fieldNumber: 2) } - if !data.isEmpty { - try visitor.visitSingularBytesField(value: data, fieldNumber: 2) - } - if !format.isEmpty { - try visitor.visitSingularStringField(value: format, fieldNumber: 3) + if !self.format.isEmpty { + try visitor.visitSingularStringField(value: self.format, fieldNumber: 3) } - if !frameID.isEmpty { - try visitor.visitSingularStringField(value: frameID, fieldNumber: 4) + if !self.frameID.isEmpty { + try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_CompressedImage, rhs: Foxglove_CompressedImage) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.frameID != rhs.frameID { return false } - if lhs.data != rhs.data { return false } - if lhs.format != rhs.format { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_CompressedImage, rhs: Foxglove_CompressedImage) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.frameID != rhs.frameID {return false} + if lhs.data != rhs.data {return false} + if lhs.format != rhs.format {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CompressedVideo.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CompressedVideo.pb.swift index b554c8c..b8c1cab 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CompressedVideo.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CompressedVideo.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,47 +30,41 @@ struct Foxglove_CompressedVideo { /// Timestamp of video frame var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} - /// Frame of reference for the video. The origin of the frame is the optical center of the camera. +x points to the - /// right in the video, +y points down, and +z points into the plane of the video. - var frameID: String = .init() + /// Frame of reference for the video. The origin of the frame is the optical center of the camera. +x points to the right in the video, +y points down, and +z points into the plane of the video. + var frameID: String = String() - /// Compressed video frame data. For packet-based video codecs this data must begin and end on packet boundaries (no - /// partial packets), and must contain enough video packets to decode exactly one image (either a keyframe or delta - /// frame). Note: Foxglove Studio does not support video streams that include B frames because they require lookahead. - var data: Data = .init() + /// Compressed video frame data. For packet-based video codecs this data must begin and end on packet boundaries (no partial packets), and must contain enough video packets to decode exactly one image (either a keyframe or delta frame). Note: Foxglove Studio does not support video streams that include B frames because they require lookahead. + var data: Data = Data() /// Video format - /// + /// /// Supported values: `h264` - var format: String = .init() + var format: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_CompressedVideo: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_CompressedVideo: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_CompressedVideo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_CompressedVideo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".CompressedVideo" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -79,47 +73,47 @@ extension Foxglove_CompressedVideo: SwiftProtobuf.Message, SwiftProtobuf._Messag 4: .same(proto: "format"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularStringField(value: &frameID) - case 3: try decoder.decodeSingularBytesField(value: &data) - case 4: try decoder.decodeSingularStringField(value: &format) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self.data) }() + case 4: try { try decoder.decodeSingularStringField(value: &self.format) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.frameID.isEmpty { + try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) } - if !frameID.isEmpty { - try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) - } - if !data.isEmpty { - try visitor.visitSingularBytesField(value: data, fieldNumber: 3) + if !self.data.isEmpty { + try visitor.visitSingularBytesField(value: self.data, fieldNumber: 3) } - if !format.isEmpty { - try visitor.visitSingularStringField(value: format, fieldNumber: 4) + if !self.format.isEmpty { + try visitor.visitSingularStringField(value: self.format, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_CompressedVideo, rhs: Foxglove_CompressedVideo) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.frameID != rhs.frameID { return false } - if lhs.data != rhs.data { return false } - if lhs.format != rhs.format { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_CompressedVideo, rhs: Foxglove_CompressedVideo) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.frameID != rhs.frameID {return false} + if lhs.data != rhs.data {return false} + if lhs.format != rhs.format {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CubePrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CubePrimitive.pb.swift index 4828bcb..9a9d393 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CubePrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CubePrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,57 +30,52 @@ struct Foxglove_CubePrimitive { /// Position of the center of the cube and orientation of the cube var pose: Foxglove_Pose { - get { _pose ?? Foxglove_Pose() } - set { _pose = newValue } + get {return _pose ?? Foxglove_Pose()} + set {_pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _pose != nil } + var hasPose: Bool {return self._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _pose = nil } + mutating func clearPose() {self._pose = nil} /// Size of the cube along each axis var size: Foxglove_Vector3 { - get { _size ?? Foxglove_Vector3() } - set { _size = newValue } + get {return _size ?? Foxglove_Vector3()} + set {_size = newValue} } - /// Returns true if `size` has been explicitly set. - var hasSize: Bool { _size != nil } + var hasSize: Bool {return self._size != nil} /// Clears the value of `size`. Subsequent reads from it will return its default value. - mutating func clearSize() { _size = nil } + mutating func clearSize() {self._size = nil} /// Color of the cube var color: Foxglove_Color { - get { _color ?? Foxglove_Color() } - set { _color = newValue } + get {return _color ?? Foxglove_Color()} + set {_color = newValue} } - /// Returns true if `color` has been explicitly set. - var hasColor: Bool { _color != nil } + var hasColor: Bool {return self._color != nil} /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() { _color = nil } + mutating func clearColor() {self._color = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _pose: Foxglove_Pose? - private var _size: Foxglove_Vector3? - private var _color: Foxglove_Color? + fileprivate var _pose: Foxglove_Pose? = nil + fileprivate var _size: Foxglove_Vector3? = nil + fileprivate var _color: Foxglove_Color? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_CubePrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_CubePrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_CubePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_CubePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".CubePrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -88,28 +83,28 @@ extension Foxglove_CubePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI 3: .same(proto: "color"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_pose) - case 2: try decoder.decodeSingularMessageField(value: &_size) - case 3: try decoder.decodeSingularMessageField(value: &_color) + case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._size) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._color) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _pose { + try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } + } }() try { if let v = self._size { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() @@ -119,11 +114,11 @@ extension Foxglove_CubePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_CubePrimitive, rhs: Foxglove_CubePrimitive) -> Bool { - if lhs._pose != rhs._pose { return false } - if lhs._size != rhs._size { return false } - if lhs._color != rhs._color { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_CubePrimitive, rhs: Foxglove_CubePrimitive) -> Bool { + if lhs._pose != rhs._pose {return false} + if lhs._size != rhs._size {return false} + if lhs._color != rhs._color {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/CylinderPrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/CylinderPrimitive.pb.swift index fd57fde..da5ab0a 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/CylinderPrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/CylinderPrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -28,28 +28,25 @@ struct Foxglove_CylinderPrimitive { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - /// Position of the center of the cylinder and orientation of the cylinder. The flat face(s) are perpendicular to the - /// z-axis. + /// Position of the center of the cylinder and orientation of the cylinder. The flat face(s) are perpendicular to the z-axis. var pose: Foxglove_Pose { - get { _pose ?? Foxglove_Pose() } - set { _pose = newValue } + get {return _pose ?? Foxglove_Pose()} + set {_pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _pose != nil } + var hasPose: Bool {return self._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _pose = nil } + mutating func clearPose() {self._pose = nil} /// Size of the cylinder's bounding box var size: Foxglove_Vector3 { - get { _size ?? Foxglove_Vector3() } - set { _size = newValue } + get {return _size ?? Foxglove_Vector3()} + set {_size = newValue} } - /// Returns true if `size` has been explicitly set. - var hasSize: Bool { _size != nil } + var hasSize: Bool {return self._size != nil} /// Clears the value of `size`. Subsequent reads from it will return its default value. - mutating func clearSize() { _size = nil } + mutating func clearSize() {self._size = nil} /// 0-1, ratio of the diameter of the cylinder's bottom face (min z) to the bottom of the bounding box var bottomScale: Double = 0 @@ -59,35 +56,32 @@ struct Foxglove_CylinderPrimitive { /// Color of the cylinder var color: Foxglove_Color { - get { _color ?? Foxglove_Color() } - set { _color = newValue } + get {return _color ?? Foxglove_Color()} + set {_color = newValue} } - /// Returns true if `color` has been explicitly set. - var hasColor: Bool { _color != nil } + var hasColor: Bool {return self._color != nil} /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() { _color = nil } + mutating func clearColor() {self._color = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _pose: Foxglove_Pose? - private var _size: Foxglove_Vector3? - private var _color: Foxglove_Color? + fileprivate var _pose: Foxglove_Pose? = nil + fileprivate var _size: Foxglove_Vector3? = nil + fileprivate var _color: Foxglove_Color? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_CylinderPrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_CylinderPrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_CylinderPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_CylinderPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".CylinderPrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -97,38 +91,38 @@ extension Foxglove_CylinderPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Mess 5: .same(proto: "color"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_pose) - case 2: try decoder.decodeSingularMessageField(value: &_size) - case 3: try decoder.decodeSingularDoubleField(value: &bottomScale) - case 4: try decoder.decodeSingularDoubleField(value: &topScale) - case 5: try decoder.decodeSingularMessageField(value: &_color) + case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._size) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.bottomScale) }() + case 4: try { try decoder.decodeSingularDoubleField(value: &self.topScale) }() + case 5: try { try decoder.decodeSingularMessageField(value: &self._color) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _pose { + try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } + } }() try { if let v = self._size { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() - if bottomScale != 0 { - try visitor.visitSingularDoubleField(value: bottomScale, fieldNumber: 3) + if self.bottomScale != 0 { + try visitor.visitSingularDoubleField(value: self.bottomScale, fieldNumber: 3) } - if topScale != 0 { - try visitor.visitSingularDoubleField(value: topScale, fieldNumber: 4) + if self.topScale != 0 { + try visitor.visitSingularDoubleField(value: self.topScale, fieldNumber: 4) } try { if let v = self._color { try visitor.visitSingularMessageField(value: v, fieldNumber: 5) @@ -136,13 +130,13 @@ extension Foxglove_CylinderPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Mess try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_CylinderPrimitive, rhs: Foxglove_CylinderPrimitive) -> Bool { - if lhs._pose != rhs._pose { return false } - if lhs._size != rhs._size { return false } - if lhs.bottomScale != rhs.bottomScale { return false } - if lhs.topScale != rhs.topScale { return false } - if lhs._color != rhs._color { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_CylinderPrimitive, rhs: Foxglove_CylinderPrimitive) -> Bool { + if lhs._pose != rhs._pose {return false} + if lhs._size != rhs._size {return false} + if lhs.bottomScale != rhs.bottomScale {return false} + if lhs.topScale != rhs.topScale {return false} + if lhs._color != rhs._color {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/FrameTransform.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/FrameTransform.pb.swift index a0e3cb6..6b212ca 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/FrameTransform.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/FrameTransform.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,63 +30,58 @@ struct Foxglove_FrameTransform { /// Timestamp of transform var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Name of the parent frame - var parentFrameID: String = .init() + var parentFrameID: String = String() /// Name of the child frame - var childFrameID: String = .init() + var childFrameID: String = String() /// Translation component of the transform var translation: Foxglove_Vector3 { - get { _translation ?? Foxglove_Vector3() } - set { _translation = newValue } + get {return _translation ?? Foxglove_Vector3()} + set {_translation = newValue} } - /// Returns true if `translation` has been explicitly set. - var hasTranslation: Bool { _translation != nil } + var hasTranslation: Bool {return self._translation != nil} /// Clears the value of `translation`. Subsequent reads from it will return its default value. - mutating func clearTranslation() { _translation = nil } + mutating func clearTranslation() {self._translation = nil} /// Rotation component of the transform var rotation: Foxglove_Quaternion { - get { _rotation ?? Foxglove_Quaternion() } - set { _rotation = newValue } + get {return _rotation ?? Foxglove_Quaternion()} + set {_rotation = newValue} } - /// Returns true if `rotation` has been explicitly set. - var hasRotation: Bool { _rotation != nil } + var hasRotation: Bool {return self._rotation != nil} /// Clears the value of `rotation`. Subsequent reads from it will return its default value. - mutating func clearRotation() { _rotation = nil } + mutating func clearRotation() {self._rotation = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? - private var _translation: Foxglove_Vector3? - private var _rotation: Foxglove_Quaternion? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + fileprivate var _translation: Foxglove_Vector3? = nil + fileprivate var _rotation: Foxglove_Quaternion? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_FrameTransform: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_FrameTransform: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_FrameTransform: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_FrameTransform: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".FrameTransform" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -96,35 +91,35 @@ extension Foxglove_FrameTransform: SwiftProtobuf.Message, SwiftProtobuf._Message 5: .same(proto: "rotation"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularStringField(value: &parentFrameID) - case 3: try decoder.decodeSingularStringField(value: &childFrameID) - case 4: try decoder.decodeSingularMessageField(value: &_translation) - case 5: try decoder.decodeSingularMessageField(value: &_rotation) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.parentFrameID) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.childFrameID) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._translation) }() + case 5: try { try decoder.decodeSingularMessageField(value: &self._rotation) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.parentFrameID.isEmpty { + try visitor.visitSingularStringField(value: self.parentFrameID, fieldNumber: 2) } - if !parentFrameID.isEmpty { - try visitor.visitSingularStringField(value: parentFrameID, fieldNumber: 2) - } - if !childFrameID.isEmpty { - try visitor.visitSingularStringField(value: childFrameID, fieldNumber: 3) + if !self.childFrameID.isEmpty { + try visitor.visitSingularStringField(value: self.childFrameID, fieldNumber: 3) } try { if let v = self._translation { try visitor.visitSingularMessageField(value: v, fieldNumber: 4) @@ -135,13 +130,13 @@ extension Foxglove_FrameTransform: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_FrameTransform, rhs: Foxglove_FrameTransform) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.parentFrameID != rhs.parentFrameID { return false } - if lhs.childFrameID != rhs.childFrameID { return false } - if lhs._translation != rhs._translation { return false } - if lhs._rotation != rhs._rotation { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_FrameTransform, rhs: Foxglove_FrameTransform) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.parentFrameID != rhs.parentFrameID {return false} + if lhs.childFrameID != rhs.childFrameID {return false} + if lhs._translation != rhs._translation {return false} + if lhs._rotation != rhs._rotation {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/FrameTransforms.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/FrameTransforms.pb.swift index c5a6964..43535d5 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/FrameTransforms.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/FrameTransforms.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -37,43 +37,41 @@ struct Foxglove_FrameTransforms { } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_FrameTransforms: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_FrameTransforms: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_FrameTransforms: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_FrameTransforms: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".FrameTransforms" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "transforms"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeRepeatedMessageField(value: &transforms) + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.transforms) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if !transforms.isEmpty { - try visitor.visitRepeatedMessageField(value: transforms, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if !self.transforms.isEmpty { + try visitor.visitRepeatedMessageField(value: self.transforms, fieldNumber: 1) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_FrameTransforms, rhs: Foxglove_FrameTransforms) -> Bool { - if lhs.transforms != rhs.transforms { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_FrameTransforms, rhs: Foxglove_FrameTransforms) -> Bool { + if lhs.transforms != rhs.transforms {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/GeoJSON.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/GeoJSON.pb.swift index e97ec3b..291be86 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/GeoJSON.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/GeoJSON.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -29,7 +29,7 @@ struct Foxglove_GeoJSON { // methods supported on all messages. /// GeoJSON data encoded as a UTF-8 string - var geojson: String = .init() + var geojson: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() @@ -37,43 +37,41 @@ struct Foxglove_GeoJSON { } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_GeoJSON: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_GeoJSON: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_GeoJSON: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_GeoJSON: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".GeoJSON" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "geojson"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &geojson) + case 1: try { try decoder.decodeSingularStringField(value: &self.geojson) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if !geojson.isEmpty { - try visitor.visitSingularStringField(value: geojson, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if !self.geojson.isEmpty { + try visitor.visitSingularStringField(value: self.geojson, fieldNumber: 1) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_GeoJSON, rhs: Foxglove_GeoJSON) -> Bool { - if lhs.geojson != rhs.geojson { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_GeoJSON, rhs: Foxglove_GeoJSON) -> Bool { + if lhs.geojson != rhs.geojson {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Grid.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Grid.pb.swift index 07ffa83..1167dde 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Grid.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Grid.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,92 +30,86 @@ struct Foxglove_Grid { /// Timestamp of grid var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _storage._timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _uniqueStorage()._timestamp = newValue } + get {return _storage._timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_uniqueStorage()._timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _storage._timestamp != nil } + var hasTimestamp: Bool {return _storage._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _uniqueStorage()._timestamp = nil } + mutating func clearTimestamp() {_uniqueStorage()._timestamp = nil} /// Frame of reference var frameID: String { - get { _storage._frameID } - set { _uniqueStorage()._frameID = newValue } + get {return _storage._frameID} + set {_uniqueStorage()._frameID = newValue} } - /// Origin of grid's corner relative to frame of reference; grid is positioned in the x-y plane relative to this - /// origin + /// Origin of grid's corner relative to frame of reference; grid is positioned in the x-y plane relative to this origin var pose: Foxglove_Pose { - get { _storage._pose ?? Foxglove_Pose() } - set { _uniqueStorage()._pose = newValue } + get {return _storage._pose ?? Foxglove_Pose()} + set {_uniqueStorage()._pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _storage._pose != nil } + var hasPose: Bool {return _storage._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _uniqueStorage()._pose = nil } + mutating func clearPose() {_uniqueStorage()._pose = nil} /// Number of grid columns var columnCount: UInt32 { - get { _storage._columnCount } - set { _uniqueStorage()._columnCount = newValue } + get {return _storage._columnCount} + set {_uniqueStorage()._columnCount = newValue} } /// Size of single grid cell along x and y axes, relative to `pose` var cellSize: Foxglove_Vector2 { - get { _storage._cellSize ?? Foxglove_Vector2() } - set { _uniqueStorage()._cellSize = newValue } + get {return _storage._cellSize ?? Foxglove_Vector2()} + set {_uniqueStorage()._cellSize = newValue} } - /// Returns true if `cellSize` has been explicitly set. - var hasCellSize: Bool { _storage._cellSize != nil } + var hasCellSize: Bool {return _storage._cellSize != nil} /// Clears the value of `cellSize`. Subsequent reads from it will return its default value. - mutating func clearCellSize() { _uniqueStorage()._cellSize = nil } + mutating func clearCellSize() {_uniqueStorage()._cellSize = nil} /// Number of bytes between rows in `data` var rowStride: UInt32 { - get { _storage._rowStride } - set { _uniqueStorage()._rowStride = newValue } + get {return _storage._rowStride} + set {_uniqueStorage()._rowStride = newValue} } /// Number of bytes between cells within a row in `data` var cellStride: UInt32 { - get { _storage._cellStride } - set { _uniqueStorage()._cellStride = newValue } + get {return _storage._cellStride} + set {_uniqueStorage()._cellStride = newValue} } /// Fields in `data`. `red`, `green`, `blue`, and `alpha` are optional for customizing the grid's color. var fields: [Foxglove_PackedElementField] { - get { _storage._fields } - set { _uniqueStorage()._fields = newValue } + get {return _storage._fields} + set {_uniqueStorage()._fields = newValue} } /// Grid cell data, interpreted using `fields`, in row-major (y-major) order var data: Data { - get { _storage._data } - set { _uniqueStorage()._data = newValue } + get {return _storage._data} + set {_uniqueStorage()._data = newValue} } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _storage = _StorageClass.defaultInstance + fileprivate var _storage = _StorageClass.defaultInstance } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_Grid: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_Grid: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Grid" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -130,15 +124,15 @@ extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa ] fileprivate class _StorageClass { - var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? - var _frameID: String = .init() - var _pose: Foxglove_Pose? + var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + var _frameID: String = String() + var _pose: Foxglove_Pose? = nil var _columnCount: UInt32 = 0 - var _cellSize: Foxglove_Vector2? + var _cellSize: Foxglove_Vector2? = nil var _rowStride: UInt32 = 0 var _cellStride: UInt32 = 0 var _fields: [Foxglove_PackedElementField] = [] - var _data: Data = .init() + var _data: Data = Data() static let defaultInstance = _StorageClass() @@ -164,7 +158,7 @@ extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa return _storage } - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -172,22 +166,22 @@ extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_storage._timestamp) - case 2: try decoder.decodeSingularStringField(value: &_storage._frameID) - case 3: try decoder.decodeSingularMessageField(value: &_storage._pose) - case 4: try decoder.decodeSingularFixed32Field(value: &_storage._columnCount) - case 5: try decoder.decodeSingularMessageField(value: &_storage._cellSize) - case 6: try decoder.decodeSingularFixed32Field(value: &_storage._rowStride) - case 7: try decoder.decodeSingularFixed32Field(value: &_storage._cellStride) - case 8: try decoder.decodeRepeatedMessageField(value: &_storage._fields) - case 9: try decoder.decodeSingularBytesField(value: &_storage._data) + case 1: try { try decoder.decodeSingularMessageField(value: &_storage._timestamp) }() + case 2: try { try decoder.decodeSingularStringField(value: &_storage._frameID) }() + case 3: try { try decoder.decodeSingularMessageField(value: &_storage._pose) }() + case 4: try { try decoder.decodeSingularFixed32Field(value: &_storage._columnCount) }() + case 5: try { try decoder.decodeSingularMessageField(value: &_storage._cellSize) }() + case 6: try { try decoder.decodeSingularFixed32Field(value: &_storage._rowStride) }() + case 7: try { try decoder.decodeSingularFixed32Field(value: &_storage._cellStride) }() + case 8: try { try decoder.decodeRepeatedMessageField(value: &_storage._fields) }() + case 9: try { try decoder.decodeSingularBytesField(value: &_storage._data) }() default: break } } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { try withExtendedLifetime(_storage) { (_storage: _StorageClass) in // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations @@ -224,28 +218,25 @@ extension Foxglove_Grid: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_Grid, rhs: Foxglove_Grid) -> Bool { + static func ==(lhs: Foxglove_Grid, rhs: Foxglove_Grid) -> Bool { if lhs._storage !== rhs._storage { - let storagesAreEqual: Bool = withExtendedLifetime(( - lhs._storage, - rhs._storage - )) { (_args: (_StorageClass, _StorageClass)) in + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 let rhs_storage = _args.1 - if _storage._timestamp != rhs_storage._timestamp { return false } - if _storage._frameID != rhs_storage._frameID { return false } - if _storage._pose != rhs_storage._pose { return false } - if _storage._columnCount != rhs_storage._columnCount { return false } - if _storage._cellSize != rhs_storage._cellSize { return false } - if _storage._rowStride != rhs_storage._rowStride { return false } - if _storage._cellStride != rhs_storage._cellStride { return false } - if _storage._fields != rhs_storage._fields { return false } - if _storage._data != rhs_storage._data { return false } + if _storage._timestamp != rhs_storage._timestamp {return false} + if _storage._frameID != rhs_storage._frameID {return false} + if _storage._pose != rhs_storage._pose {return false} + if _storage._columnCount != rhs_storage._columnCount {return false} + if _storage._cellSize != rhs_storage._cellSize {return false} + if _storage._rowStride != rhs_storage._rowStride {return false} + if _storage._cellStride != rhs_storage._cellStride {return false} + if _storage._fields != rhs_storage._fields {return false} + if _storage._data != rhs_storage._data {return false} return true } - if !storagesAreEqual { return false } + if !storagesAreEqual {return false} } - if lhs.unknownFields != rhs.unknownFields { return false } + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/ImageAnnotations.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/ImageAnnotations.pb.swift index 4527e23..c5c9d7e 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/ImageAnnotations.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/ImageAnnotations.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -43,16 +43,14 @@ struct Foxglove_ImageAnnotations { } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_ImageAnnotations: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_ImageAnnotations: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_ImageAnnotations: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_ImageAnnotations: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ImageAnnotations" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "circles"), @@ -60,38 +58,38 @@ extension Foxglove_ImageAnnotations: SwiftProtobuf.Message, SwiftProtobuf._Messa 3: .same(proto: "texts"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeRepeatedMessageField(value: &circles) - case 2: try decoder.decodeRepeatedMessageField(value: &points) - case 3: try decoder.decodeRepeatedMessageField(value: &texts) + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.circles) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.points) }() + case 3: try { try decoder.decodeRepeatedMessageField(value: &self.texts) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if !circles.isEmpty { - try visitor.visitRepeatedMessageField(value: circles, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if !self.circles.isEmpty { + try visitor.visitRepeatedMessageField(value: self.circles, fieldNumber: 1) } - if !points.isEmpty { - try visitor.visitRepeatedMessageField(value: points, fieldNumber: 2) + if !self.points.isEmpty { + try visitor.visitRepeatedMessageField(value: self.points, fieldNumber: 2) } - if !texts.isEmpty { - try visitor.visitRepeatedMessageField(value: texts, fieldNumber: 3) + if !self.texts.isEmpty { + try visitor.visitRepeatedMessageField(value: self.texts, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_ImageAnnotations, rhs: Foxglove_ImageAnnotations) -> Bool { - if lhs.circles != rhs.circles { return false } - if lhs.points != rhs.points { return false } - if lhs.texts != rhs.texts { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_ImageAnnotations, rhs: Foxglove_ImageAnnotations) -> Bool { + if lhs.circles != rhs.circles {return false} + if lhs.points != rhs.points {return false} + if lhs.texts != rhs.texts {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/KeyValuePair.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/KeyValuePair.pb.swift index e3b450d..2497e56 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/KeyValuePair.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/KeyValuePair.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -29,10 +29,10 @@ struct Foxglove_KeyValuePair { // methods supported on all messages. /// Key - var key: String = .init() + var key: String = String() /// Value - var value: String = .init() + var value: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() @@ -40,49 +40,47 @@ struct Foxglove_KeyValuePair { } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_KeyValuePair: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_KeyValuePair: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_KeyValuePair: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_KeyValuePair: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".KeyValuePair" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "key"), 2: .same(proto: "value"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &key) - case 2: try decoder.decodeSingularStringField(value: &value) + case 1: try { try decoder.decodeSingularStringField(value: &self.key) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.value) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if !key.isEmpty { - try visitor.visitSingularStringField(value: key, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if !self.key.isEmpty { + try visitor.visitSingularStringField(value: self.key, fieldNumber: 1) } - if !value.isEmpty { - try visitor.visitSingularStringField(value: value, fieldNumber: 2) + if !self.value.isEmpty { + try visitor.visitSingularStringField(value: self.value, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_KeyValuePair, rhs: Foxglove_KeyValuePair) -> Bool { - if lhs.key != rhs.key { return false } - if lhs.value != rhs.value { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_KeyValuePair, rhs: Foxglove_KeyValuePair) -> Bool { + if lhs.key != rhs.key {return false} + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/LaserScan.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/LaserScan.pb.swift index f017da3..24b1a8c 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/LaserScan.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/LaserScan.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,29 +30,26 @@ struct Foxglove_LaserScan { /// Timestamp of scan var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Frame of reference - var frameID: String = .init() + var frameID: String = String() - /// Origin of scan relative to frame of reference; points are positioned in the x-y plane relative to this origin; - /// angles are interpreted as counterclockwise rotations around the z axis with 0 rad being in the +x direction + /// Origin of scan relative to frame of reference; points are positioned in the x-y plane relative to this origin; angles are interpreted as counterclockwise rotations around the z axis with 0 rad being in the +x direction var pose: Foxglove_Pose { - get { _pose ?? Foxglove_Pose() } - set { _pose = newValue } + get {return _pose ?? Foxglove_Pose()} + set {_pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _pose != nil } + var hasPose: Bool {return self._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _pose = nil } + mutating func clearPose() {self._pose = nil} /// Bearing of first point, in radians var startAngle: Double = 0 @@ -70,21 +67,19 @@ struct Foxglove_LaserScan { init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? - private var _pose: Foxglove_Pose? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + fileprivate var _pose: Foxglove_Pose? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_LaserScan: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_LaserScan: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_LaserScan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_LaserScan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".LaserScan" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -96,62 +91,62 @@ extension Foxglove_LaserScan: SwiftProtobuf.Message, SwiftProtobuf._MessageImple 7: .same(proto: "intensities"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularStringField(value: &frameID) - case 3: try decoder.decodeSingularMessageField(value: &_pose) - case 4: try decoder.decodeSingularDoubleField(value: &startAngle) - case 5: try decoder.decodeSingularDoubleField(value: &endAngle) - case 6: try decoder.decodeRepeatedDoubleField(value: &ranges) - case 7: try decoder.decodeRepeatedDoubleField(value: &intensities) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._pose) }() + case 4: try { try decoder.decodeSingularDoubleField(value: &self.startAngle) }() + case 5: try { try decoder.decodeSingularDoubleField(value: &self.endAngle) }() + case 6: try { try decoder.decodeRepeatedDoubleField(value: &self.ranges) }() + case 7: try { try decoder.decodeRepeatedDoubleField(value: &self.intensities) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - if !frameID.isEmpty { - try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) + } }() + if !self.frameID.isEmpty { + try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) } try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 3) } }() - if startAngle != 0 { - try visitor.visitSingularDoubleField(value: startAngle, fieldNumber: 4) + if self.startAngle != 0 { + try visitor.visitSingularDoubleField(value: self.startAngle, fieldNumber: 4) } - if endAngle != 0 { - try visitor.visitSingularDoubleField(value: endAngle, fieldNumber: 5) + if self.endAngle != 0 { + try visitor.visitSingularDoubleField(value: self.endAngle, fieldNumber: 5) } - if !ranges.isEmpty { - try visitor.visitPackedDoubleField(value: ranges, fieldNumber: 6) + if !self.ranges.isEmpty { + try visitor.visitPackedDoubleField(value: self.ranges, fieldNumber: 6) } - if !intensities.isEmpty { - try visitor.visitPackedDoubleField(value: intensities, fieldNumber: 7) + if !self.intensities.isEmpty { + try visitor.visitPackedDoubleField(value: self.intensities, fieldNumber: 7) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_LaserScan, rhs: Foxglove_LaserScan) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.frameID != rhs.frameID { return false } - if lhs._pose != rhs._pose { return false } - if lhs.startAngle != rhs.startAngle { return false } - if lhs.endAngle != rhs.endAngle { return false } - if lhs.ranges != rhs.ranges { return false } - if lhs.intensities != rhs.intensities { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_LaserScan, rhs: Foxglove_LaserScan) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.frameID != rhs.frameID {return false} + if lhs._pose != rhs._pose {return false} + if lhs.startAngle != rhs.startAngle {return false} + if lhs.endAngle != rhs.endAngle {return false} + if lhs.ranges != rhs.ranges {return false} + if lhs.intensities != rhs.intensities {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/LinePrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/LinePrimitive.pb.swift index 7cfbae0..fb33a3d 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/LinePrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/LinePrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,65 +30,60 @@ struct Foxglove_LinePrimitive { /// Drawing primitive to use for lines var type: Foxglove_LinePrimitive.TypeEnum { - get { _storage._type } - set { _uniqueStorage()._type = newValue } + get {return _storage._type} + set {_uniqueStorage()._type = newValue} } /// Origin of lines relative to reference frame var pose: Foxglove_Pose { - get { _storage._pose ?? Foxglove_Pose() } - set { _uniqueStorage()._pose = newValue } + get {return _storage._pose ?? Foxglove_Pose()} + set {_uniqueStorage()._pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _storage._pose != nil } + var hasPose: Bool {return _storage._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _uniqueStorage()._pose = nil } + mutating func clearPose() {_uniqueStorage()._pose = nil} /// Line thickness var thickness: Double { - get { _storage._thickness } - set { _uniqueStorage()._thickness = newValue } + get {return _storage._thickness} + set {_uniqueStorage()._thickness = newValue} } - /// Indicates whether `thickness` is a fixed size in screen pixels (true), or specified in world coordinates and - /// scales with distance from the camera (false) + /// Indicates whether `thickness` is a fixed size in screen pixels (true), or specified in world coordinates and scales with distance from the camera (false) var scaleInvariant: Bool { - get { _storage._scaleInvariant } - set { _uniqueStorage()._scaleInvariant = newValue } + get {return _storage._scaleInvariant} + set {_uniqueStorage()._scaleInvariant = newValue} } /// Points along the line var points: [Foxglove_Point3] { - get { _storage._points } - set { _uniqueStorage()._points = newValue } + get {return _storage._points} + set {_uniqueStorage()._points = newValue} } /// Solid color to use for the whole line. One of `color` or `colors` must be provided. var color: Foxglove_Color { - get { _storage._color ?? Foxglove_Color() } - set { _uniqueStorage()._color = newValue } + get {return _storage._color ?? Foxglove_Color()} + set {_uniqueStorage()._color = newValue} } - /// Returns true if `color` has been explicitly set. - var hasColor: Bool { _storage._color != nil } + var hasColor: Bool {return _storage._color != nil} /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() { _uniqueStorage()._color = nil } + mutating func clearColor() {_uniqueStorage()._color = nil} - /// Per-point colors (if specified, must have the same length as `points`). One of `color` or `colors` must be - /// provided. + /// Per-point colors (if specified, must have the same length as `points`). One of `color` or `colors` must be provided. var colors: [Foxglove_Color] { - get { _storage._colors } - set { _uniqueStorage()._colors = newValue } + get {return _storage._colors} + set {_uniqueStorage()._colors = newValue} } /// Indices into the `points` and `colors` attribute arrays, which can be used to avoid duplicating attribute data. - /// - /// If omitted or empty, indexing will not be used. This default behavior is equivalent to specifying [0, 1, ..., N-1] - /// for the indices (where N is the number of `points` provided). + /// + /// If omitted or empty, indexing will not be used. This default behavior is equivalent to specifying [0, 1, ..., N-1] for the indices (where N is the number of `points` provided). var indices: [UInt32] { - get { _storage._indices } - set { _uniqueStorage()._indices = newValue } + get {return _storage._indices} + set {_uniqueStorage()._indices = newValue} } var unknownFields = SwiftProtobuf.UnknownStorage() @@ -122,44 +117,43 @@ struct Foxglove_LinePrimitive { var rawValue: Int { switch self { - case .lineStrip: 0 - case .lineLoop: 1 - case .lineList: 2 - case let .UNRECOGNIZED(i): i + case .lineStrip: return 0 + case .lineLoop: return 1 + case .lineList: return 2 + case .UNRECOGNIZED(let i): return i } } + } init() {} - private var _storage = _StorageClass.defaultInstance + fileprivate var _storage = _StorageClass.defaultInstance } #if swift(>=4.2) - extension Foxglove_LinePrimitive.TypeEnum: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_LinePrimitive.TypeEnum] = [ - .lineStrip, - .lineLoop, - .lineList, - ] - } +extension Foxglove_LinePrimitive.TypeEnum: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_LinePrimitive.TypeEnum] = [ + .lineStrip, + .lineLoop, + .lineList, + ] +} -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_LinePrimitive: @unchecked Sendable {} - extension Foxglove_LinePrimitive.TypeEnum: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_LinePrimitive: @unchecked Sendable {} +extension Foxglove_LinePrimitive.TypeEnum: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".LinePrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "type"), @@ -174,11 +168,11 @@ extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI fileprivate class _StorageClass { var _type: Foxglove_LinePrimitive.TypeEnum = .lineStrip - var _pose: Foxglove_Pose? + var _pose: Foxglove_Pose? = nil var _thickness: Double = 0 var _scaleInvariant: Bool = false var _points: [Foxglove_Point3] = [] - var _color: Foxglove_Color? + var _color: Foxglove_Color? = nil var _colors: [Foxglove_Color] = [] var _indices: [UInt32] = [] @@ -205,7 +199,7 @@ extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI return _storage } - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -213,21 +207,21 @@ extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularEnumField(value: &_storage._type) - case 2: try decoder.decodeSingularMessageField(value: &_storage._pose) - case 3: try decoder.decodeSingularDoubleField(value: &_storage._thickness) - case 4: try decoder.decodeSingularBoolField(value: &_storage._scaleInvariant) - case 5: try decoder.decodeRepeatedMessageField(value: &_storage._points) - case 6: try decoder.decodeSingularMessageField(value: &_storage._color) - case 7: try decoder.decodeRepeatedMessageField(value: &_storage._colors) - case 8: try decoder.decodeRepeatedFixed32Field(value: &_storage._indices) + case 1: try { try decoder.decodeSingularEnumField(value: &_storage._type) }() + case 2: try { try decoder.decodeSingularMessageField(value: &_storage._pose) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &_storage._thickness) }() + case 4: try { try decoder.decodeSingularBoolField(value: &_storage._scaleInvariant) }() + case 5: try { try decoder.decodeRepeatedMessageField(value: &_storage._points) }() + case 6: try { try decoder.decodeSingularMessageField(value: &_storage._color) }() + case 7: try { try decoder.decodeRepeatedMessageField(value: &_storage._colors) }() + case 8: try { try decoder.decodeRepeatedFixed32Field(value: &_storage._indices) }() default: break } } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { try withExtendedLifetime(_storage) { (_storage: _StorageClass) in // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations @@ -261,27 +255,24 @@ extension Foxglove_LinePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_LinePrimitive, rhs: Foxglove_LinePrimitive) -> Bool { + static func ==(lhs: Foxglove_LinePrimitive, rhs: Foxglove_LinePrimitive) -> Bool { if lhs._storage !== rhs._storage { - let storagesAreEqual: Bool = withExtendedLifetime(( - lhs._storage, - rhs._storage - )) { (_args: (_StorageClass, _StorageClass)) in + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 let rhs_storage = _args.1 - if _storage._type != rhs_storage._type { return false } - if _storage._pose != rhs_storage._pose { return false } - if _storage._thickness != rhs_storage._thickness { return false } - if _storage._scaleInvariant != rhs_storage._scaleInvariant { return false } - if _storage._points != rhs_storage._points { return false } - if _storage._color != rhs_storage._color { return false } - if _storage._colors != rhs_storage._colors { return false } - if _storage._indices != rhs_storage._indices { return false } + if _storage._type != rhs_storage._type {return false} + if _storage._pose != rhs_storage._pose {return false} + if _storage._thickness != rhs_storage._thickness {return false} + if _storage._scaleInvariant != rhs_storage._scaleInvariant {return false} + if _storage._points != rhs_storage._points {return false} + if _storage._color != rhs_storage._color {return false} + if _storage._colors != rhs_storage._colors {return false} + if _storage._indices != rhs_storage._indices {return false} return true } - if !storagesAreEqual { return false } + if !storagesAreEqual {return false} } - if lhs.unknownFields != rhs.unknownFields { return false } + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/LocationFix.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/LocationFix.pb.swift index 3a43dfb..ca2d706 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/LocationFix.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/LocationFix.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,17 +30,16 @@ struct Foxglove_LocationFix { /// Timestamp of the message var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Frame for the sensor. Latitude and longitude readings are at the origin of the frame. - var frameID: String = .init() + var frameID: String = String() /// Latitude in degrees var latitude: Double = 0 @@ -51,8 +50,7 @@ struct Foxglove_LocationFix { /// Altitude in meters var altitude: Double = 0 - /// Position covariance (m^2) defined relative to a tangential plane through the reported position. The components are - /// East, North, and Up (ENU), in row-major order. + /// Position covariance (m^2) defined relative to a tangential plane through the reported position. The components are East, North, and Up (ENU), in row-major order. var positionCovariance: [Double] = [] /// If `position_covariance` is available, `position_covariance_type` must be set to indicate the type of covariance. @@ -85,46 +83,45 @@ struct Foxglove_LocationFix { var rawValue: Int { switch self { - case .unknown: 0 - case .approximated: 1 - case .diagonalKnown: 2 - case .known: 3 - case let .UNRECOGNIZED(i): i + case .unknown: return 0 + case .approximated: return 1 + case .diagonalKnown: return 2 + case .known: return 3 + case .UNRECOGNIZED(let i): return i } } + } init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil } #if swift(>=4.2) - extension Foxglove_LocationFix.PositionCovarianceType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_LocationFix.PositionCovarianceType] = [ - .unknown, - .approximated, - .diagonalKnown, - .known, - ] - } +extension Foxglove_LocationFix.PositionCovarianceType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_LocationFix.PositionCovarianceType] = [ + .unknown, + .approximated, + .diagonalKnown, + .known, + ] +} -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_LocationFix: @unchecked Sendable {} - extension Foxglove_LocationFix.PositionCovarianceType: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_LocationFix: @unchecked Sendable {} +extension Foxglove_LocationFix.PositionCovarianceType: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_LocationFix: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_LocationFix: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".LocationFix" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 6: .same(proto: "timestamp"), @@ -136,62 +133,62 @@ extension Foxglove_LocationFix: SwiftProtobuf.Message, SwiftProtobuf._MessageImp 5: .standard(proto: "position_covariance_type"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularDoubleField(value: &latitude) - case 2: try decoder.decodeSingularDoubleField(value: &longitude) - case 3: try decoder.decodeSingularDoubleField(value: &altitude) - case 4: try decoder.decodeRepeatedDoubleField(value: &positionCovariance) - case 5: try decoder.decodeSingularEnumField(value: &positionCovarianceType) - case 6: try decoder.decodeSingularMessageField(value: &_timestamp) - case 7: try decoder.decodeSingularStringField(value: &frameID) + case 1: try { try decoder.decodeSingularDoubleField(value: &self.latitude) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.longitude) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.altitude) }() + case 4: try { try decoder.decodeRepeatedDoubleField(value: &self.positionCovariance) }() + case 5: try { try decoder.decodeSingularEnumField(value: &self.positionCovarianceType) }() + case 6: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 7: try { try decoder.decodeSingularStringField(value: &self.frameID) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if latitude != 0 { - try visitor.visitSingularDoubleField(value: latitude, fieldNumber: 1) + if self.latitude != 0 { + try visitor.visitSingularDoubleField(value: self.latitude, fieldNumber: 1) } - if longitude != 0 { - try visitor.visitSingularDoubleField(value: longitude, fieldNumber: 2) + if self.longitude != 0 { + try visitor.visitSingularDoubleField(value: self.longitude, fieldNumber: 2) } - if altitude != 0 { - try visitor.visitSingularDoubleField(value: altitude, fieldNumber: 3) + if self.altitude != 0 { + try visitor.visitSingularDoubleField(value: self.altitude, fieldNumber: 3) } - if !positionCovariance.isEmpty { - try visitor.visitPackedDoubleField(value: positionCovariance, fieldNumber: 4) + if !self.positionCovariance.isEmpty { + try visitor.visitPackedDoubleField(value: self.positionCovariance, fieldNumber: 4) } - if positionCovarianceType != .unknown { - try visitor.visitSingularEnumField(value: positionCovarianceType, fieldNumber: 5) + if self.positionCovarianceType != .unknown { + try visitor.visitSingularEnumField(value: self.positionCovarianceType, fieldNumber: 5) } try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 6) } }() - if !frameID.isEmpty { - try visitor.visitSingularStringField(value: frameID, fieldNumber: 7) + if !self.frameID.isEmpty { + try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 7) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_LocationFix, rhs: Foxglove_LocationFix) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.frameID != rhs.frameID { return false } - if lhs.latitude != rhs.latitude { return false } - if lhs.longitude != rhs.longitude { return false } - if lhs.altitude != rhs.altitude { return false } - if lhs.positionCovariance != rhs.positionCovariance { return false } - if lhs.positionCovarianceType != rhs.positionCovarianceType { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_LocationFix, rhs: Foxglove_LocationFix) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.frameID != rhs.frameID {return false} + if lhs.latitude != rhs.latitude {return false} + if lhs.longitude != rhs.longitude {return false} + if lhs.altitude != rhs.altitude {return false} + if lhs.positionCovariance != rhs.positionCovariance {return false} + if lhs.positionCovarianceType != rhs.positionCovarianceType {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Log.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Log.pb.swift index b91822e..f6028dd 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Log.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Log.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,26 +30,25 @@ struct Foxglove_Log { /// Timestamp of log message var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Log level var level: Foxglove_Log.Level = .unknown /// Log message - var message: String = .init() + var message: String = String() /// Process or node name - var name: String = .init() + var name: String = String() /// Filename - var file: String = .init() + var file: String = String() /// Line number in the file var line: UInt32 = 0 @@ -85,50 +84,49 @@ struct Foxglove_Log { var rawValue: Int { switch self { - case .unknown: 0 - case .debug: 1 - case .info: 2 - case .warning: 3 - case .error: 4 - case .fatal: 5 - case let .UNRECOGNIZED(i): i + case .unknown: return 0 + case .debug: return 1 + case .info: return 2 + case .warning: return 3 + case .error: return 4 + case .fatal: return 5 + case .UNRECOGNIZED(let i): return i } } + } init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil } #if swift(>=4.2) - extension Foxglove_Log.Level: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_Log.Level] = [ - .unknown, - .debug, - .info, - .warning, - .error, - .fatal, - ] - } +extension Foxglove_Log.Level: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_Log.Level] = [ + .unknown, + .debug, + .info, + .warning, + .error, + .fatal, + ] +} -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_Log: @unchecked Sendable {} - extension Foxglove_Log.Level: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_Log: @unchecked Sendable {} +extension Foxglove_Log.Level: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_Log: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_Log: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Log" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -139,57 +137,57 @@ extension Foxglove_Log: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat 6: .same(proto: "line"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularEnumField(value: &level) - case 3: try decoder.decodeSingularStringField(value: &message) - case 4: try decoder.decodeSingularStringField(value: &name) - case 5: try decoder.decodeSingularStringField(value: &file) - case 6: try decoder.decodeSingularFixed32Field(value: &line) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self.level) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.message) }() + case 4: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 5: try { try decoder.decodeSingularStringField(value: &self.file) }() + case 6: try { try decoder.decodeSingularFixed32Field(value: &self.line) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.level != .unknown { + try visitor.visitSingularEnumField(value: self.level, fieldNumber: 2) } - if level != .unknown { - try visitor.visitSingularEnumField(value: level, fieldNumber: 2) - } - if !message.isEmpty { - try visitor.visitSingularStringField(value: message, fieldNumber: 3) + if !self.message.isEmpty { + try visitor.visitSingularStringField(value: self.message, fieldNumber: 3) } - if !name.isEmpty { - try visitor.visitSingularStringField(value: name, fieldNumber: 4) + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 4) } - if !file.isEmpty { - try visitor.visitSingularStringField(value: file, fieldNumber: 5) + if !self.file.isEmpty { + try visitor.visitSingularStringField(value: self.file, fieldNumber: 5) } - if line != 0 { - try visitor.visitSingularFixed32Field(value: line, fieldNumber: 6) + if self.line != 0 { + try visitor.visitSingularFixed32Field(value: self.line, fieldNumber: 6) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_Log, rhs: Foxglove_Log) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.level != rhs.level { return false } - if lhs.message != rhs.message { return false } - if lhs.name != rhs.name { return false } - if lhs.file != rhs.file { return false } - if lhs.line != rhs.line { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_Log, rhs: Foxglove_Log) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.level != rhs.level {return false} + if lhs.message != rhs.message {return false} + if lhs.name != rhs.name {return false} + if lhs.file != rhs.file {return false} + if lhs.line != rhs.line {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/ModelPrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/ModelPrimitive.pb.swift index 92bb425..e5f9f57 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/ModelPrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/ModelPrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,82 +30,74 @@ struct Foxglove_ModelPrimitive { /// Origin of model relative to reference frame var pose: Foxglove_Pose { - get { _storage._pose ?? Foxglove_Pose() } - set { _uniqueStorage()._pose = newValue } + get {return _storage._pose ?? Foxglove_Pose()} + set {_uniqueStorage()._pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _storage._pose != nil } + var hasPose: Bool {return _storage._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _uniqueStorage()._pose = nil } + mutating func clearPose() {_uniqueStorage()._pose = nil} /// Scale factor to apply to the model along each axis var scale: Foxglove_Vector3 { - get { _storage._scale ?? Foxglove_Vector3() } - set { _uniqueStorage()._scale = newValue } + get {return _storage._scale ?? Foxglove_Vector3()} + set {_uniqueStorage()._scale = newValue} } - /// Returns true if `scale` has been explicitly set. - var hasScale: Bool { _storage._scale != nil } + var hasScale: Bool {return _storage._scale != nil} /// Clears the value of `scale`. Subsequent reads from it will return its default value. - mutating func clearScale() { _uniqueStorage()._scale = nil } + mutating func clearScale() {_uniqueStorage()._scale = nil} /// Solid color to use for the whole model if `override_color` is true. var color: Foxglove_Color { - get { _storage._color ?? Foxglove_Color() } - set { _uniqueStorage()._color = newValue } + get {return _storage._color ?? Foxglove_Color()} + set {_uniqueStorage()._color = newValue} } - /// Returns true if `color` has been explicitly set. - var hasColor: Bool { _storage._color != nil } + var hasColor: Bool {return _storage._color != nil} /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() { _uniqueStorage()._color = nil } + mutating func clearColor() {_uniqueStorage()._color = nil} /// Whether to use the color specified in `color` instead of any materials embedded in the original model. var overrideColor: Bool { - get { _storage._overrideColor } - set { _uniqueStorage()._overrideColor = newValue } + get {return _storage._overrideColor} + set {_uniqueStorage()._overrideColor = newValue} } /// URL pointing to model file. One of `url` or `data` should be provided. var url: String { - get { _storage._url } - set { _uniqueStorage()._url = newValue } + get {return _storage._url} + set {_uniqueStorage()._url = newValue} } - /// [Media type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of embedded model (e.g. - /// `model/gltf-binary`). Required if `data` is provided instead of `url`. Overrides the inferred media type if `url` - /// is provided. + /// [Media type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of embedded model (e.g. `model/gltf-binary`). Required if `data` is provided instead of `url`. Overrides the inferred media type if `url` is provided. var mediaType: String { - get { _storage._mediaType } - set { _uniqueStorage()._mediaType = newValue } + get {return _storage._mediaType} + set {_uniqueStorage()._mediaType = newValue} } - /// Embedded model. One of `url` or `data` should be provided. If `data` is provided, `media_type` must be set to - /// indicate the type of the data. + /// Embedded model. One of `url` or `data` should be provided. If `data` is provided, `media_type` must be set to indicate the type of the data. var data: Data { - get { _storage._data } - set { _uniqueStorage()._data = newValue } + get {return _storage._data} + set {_uniqueStorage()._data = newValue} } var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _storage = _StorageClass.defaultInstance + fileprivate var _storage = _StorageClass.defaultInstance } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_ModelPrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_ModelPrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".ModelPrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -118,13 +110,13 @@ extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message ] fileprivate class _StorageClass { - var _pose: Foxglove_Pose? - var _scale: Foxglove_Vector3? - var _color: Foxglove_Color? + var _pose: Foxglove_Pose? = nil + var _scale: Foxglove_Vector3? = nil + var _color: Foxglove_Color? = nil var _overrideColor: Bool = false - var _url: String = .init() - var _mediaType: String = .init() - var _data: Data = .init() + var _url: String = String() + var _mediaType: String = String() + var _data: Data = Data() static let defaultInstance = _StorageClass() @@ -148,7 +140,7 @@ extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message return _storage } - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { @@ -156,20 +148,20 @@ extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_storage._pose) - case 2: try decoder.decodeSingularMessageField(value: &_storage._scale) - case 3: try decoder.decodeSingularMessageField(value: &_storage._color) - case 4: try decoder.decodeSingularBoolField(value: &_storage._overrideColor) - case 5: try decoder.decodeSingularStringField(value: &_storage._url) - case 6: try decoder.decodeSingularStringField(value: &_storage._mediaType) - case 7: try decoder.decodeSingularBytesField(value: &_storage._data) + case 1: try { try decoder.decodeSingularMessageField(value: &_storage._pose) }() + case 2: try { try decoder.decodeSingularMessageField(value: &_storage._scale) }() + case 3: try { try decoder.decodeSingularMessageField(value: &_storage._color) }() + case 4: try { try decoder.decodeSingularBoolField(value: &_storage._overrideColor) }() + case 5: try { try decoder.decodeSingularStringField(value: &_storage._url) }() + case 6: try { try decoder.decodeSingularStringField(value: &_storage._mediaType) }() + case 7: try { try decoder.decodeSingularBytesField(value: &_storage._data) }() default: break } } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { try withExtendedLifetime(_storage) { (_storage: _StorageClass) in // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations @@ -200,26 +192,23 @@ extension Foxglove_ModelPrimitive: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_ModelPrimitive, rhs: Foxglove_ModelPrimitive) -> Bool { + static func ==(lhs: Foxglove_ModelPrimitive, rhs: Foxglove_ModelPrimitive) -> Bool { if lhs._storage !== rhs._storage { - let storagesAreEqual: Bool = withExtendedLifetime(( - lhs._storage, - rhs._storage - )) { (_args: (_StorageClass, _StorageClass)) in + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in let _storage = _args.0 let rhs_storage = _args.1 - if _storage._pose != rhs_storage._pose { return false } - if _storage._scale != rhs_storage._scale { return false } - if _storage._color != rhs_storage._color { return false } - if _storage._overrideColor != rhs_storage._overrideColor { return false } - if _storage._url != rhs_storage._url { return false } - if _storage._mediaType != rhs_storage._mediaType { return false } - if _storage._data != rhs_storage._data { return false } + if _storage._pose != rhs_storage._pose {return false} + if _storage._scale != rhs_storage._scale {return false} + if _storage._color != rhs_storage._color {return false} + if _storage._overrideColor != rhs_storage._overrideColor {return false} + if _storage._url != rhs_storage._url {return false} + if _storage._mediaType != rhs_storage._mediaType {return false} + if _storage._data != rhs_storage._data {return false} return true } - if !storagesAreEqual { return false } + if !storagesAreEqual {return false} } - if lhs.unknownFields != rhs.unknownFields { return false } + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/PackedElementField.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/PackedElementField.pb.swift index 924aa61..201a33c 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/PackedElementField.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/PackedElementField.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -29,7 +29,7 @@ struct Foxglove_PackedElementField { // methods supported on all messages. /// Name of the field - var name: String = .init() + var name: String = String() /// Byte offset from start of data buffer var offset: UInt32 = 0 @@ -74,18 +74,19 @@ struct Foxglove_PackedElementField { var rawValue: Int { switch self { - case .unknown: 0 - case .uint8: 1 - case .int8: 2 - case .uint16: 3 - case .int16: 4 - case .uint32: 5 - case .int32: 6 - case .float32: 7 - case .float64: 8 - case let .UNRECOGNIZED(i): i + case .unknown: return 0 + case .uint8: return 1 + case .int8: return 2 + case .uint16: return 3 + case .int16: return 4 + case .uint32: return 5 + case .int32: return 6 + case .float32: return 7 + case .float64: return 8 + case .UNRECOGNIZED(let i): return i } } + } init() {} @@ -93,35 +94,33 @@ struct Foxglove_PackedElementField { #if swift(>=4.2) - extension Foxglove_PackedElementField.NumericType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_PackedElementField.NumericType] = [ - .unknown, - .uint8, - .int8, - .uint16, - .int16, - .uint32, - .int32, - .float32, - .float64, - ] - } +extension Foxglove_PackedElementField.NumericType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_PackedElementField.NumericType] = [ + .unknown, + .uint8, + .int8, + .uint16, + .int16, + .uint32, + .int32, + .float32, + .float64, + ] +} -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_PackedElementField: @unchecked Sendable {} - extension Foxglove_PackedElementField.NumericType: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_PackedElementField: @unchecked Sendable {} +extension Foxglove_PackedElementField.NumericType: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_PackedElementField: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_PackedElementField: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".PackedElementField" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "name"), @@ -129,38 +128,38 @@ extension Foxglove_PackedElementField: SwiftProtobuf.Message, SwiftProtobuf._Mes 3: .same(proto: "type"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &name) - case 2: try decoder.decodeSingularFixed32Field(value: &offset) - case 3: try decoder.decodeSingularEnumField(value: &type) + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeSingularFixed32Field(value: &self.offset) }() + case 3: try { try decoder.decodeSingularEnumField(value: &self.type) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if !name.isEmpty { - try visitor.visitSingularStringField(value: name, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) } - if offset != 0 { - try visitor.visitSingularFixed32Field(value: offset, fieldNumber: 2) + if self.offset != 0 { + try visitor.visitSingularFixed32Field(value: self.offset, fieldNumber: 2) } - if type != .unknown { - try visitor.visitSingularEnumField(value: type, fieldNumber: 3) + if self.type != .unknown { + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_PackedElementField, rhs: Foxglove_PackedElementField) -> Bool { - if lhs.name != rhs.name { return false } - if lhs.offset != rhs.offset { return false } - if lhs.type != rhs.type { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_PackedElementField, rhs: Foxglove_PackedElementField) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.offset != rhs.offset {return false} + if lhs.type != rhs.type {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Point2.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Point2.pb.swift index 9dfe69a..fdc2b6d 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Point2.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Point2.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -40,49 +40,47 @@ struct Foxglove_Point2 { } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_Point2: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_Point2: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_Point2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_Point2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Point2" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "x"), 2: .same(proto: "y"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularDoubleField(value: &x) - case 2: try decoder.decodeSingularDoubleField(value: &y) + case 1: try { try decoder.decodeSingularDoubleField(value: &self.x) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.y) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if x != 0 { - try visitor.visitSingularDoubleField(value: x, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if self.x != 0 { + try visitor.visitSingularDoubleField(value: self.x, fieldNumber: 1) } - if y != 0 { - try visitor.visitSingularDoubleField(value: y, fieldNumber: 2) + if self.y != 0 { + try visitor.visitSingularDoubleField(value: self.y, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_Point2, rhs: Foxglove_Point2) -> Bool { - if lhs.x != rhs.x { return false } - if lhs.y != rhs.y { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_Point2, rhs: Foxglove_Point2) -> Bool { + if lhs.x != rhs.x {return false} + if lhs.y != rhs.y {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Point3.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Point3.pb.swift index 47a6000..e8759a4 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Point3.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Point3.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -43,16 +43,14 @@ struct Foxglove_Point3 { } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_Point3: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_Point3: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_Point3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_Point3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Point3" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "x"), @@ -60,38 +58,38 @@ extension Foxglove_Point3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen 3: .same(proto: "z"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularDoubleField(value: &x) - case 2: try decoder.decodeSingularDoubleField(value: &y) - case 3: try decoder.decodeSingularDoubleField(value: &z) + case 1: try { try decoder.decodeSingularDoubleField(value: &self.x) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.y) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.z) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if x != 0 { - try visitor.visitSingularDoubleField(value: x, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if self.x != 0 { + try visitor.visitSingularDoubleField(value: self.x, fieldNumber: 1) } - if y != 0 { - try visitor.visitSingularDoubleField(value: y, fieldNumber: 2) + if self.y != 0 { + try visitor.visitSingularDoubleField(value: self.y, fieldNumber: 2) } - if z != 0 { - try visitor.visitSingularDoubleField(value: z, fieldNumber: 3) + if self.z != 0 { + try visitor.visitSingularDoubleField(value: self.z, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_Point3, rhs: Foxglove_Point3) -> Bool { - if lhs.x != rhs.x { return false } - if lhs.y != rhs.y { return false } - if lhs.z != rhs.z { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_Point3, rhs: Foxglove_Point3) -> Bool { + if lhs.x != rhs.x {return false} + if lhs.y != rhs.y {return false} + if lhs.z != rhs.z {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/PointCloud.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/PointCloud.pb.swift index 608b0f7..be209f0 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/PointCloud.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/PointCloud.pb.swift @@ -17,13 +17,12 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } -/// A collection of N-dimensional points, which may contain additional fields with information like normals, intensity, -/// etc. +/// A collection of N-dimensional points, which may contain additional fields with information like normals, intensity, etc. struct Foxglove_PointCloud { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -31,58 +30,53 @@ struct Foxglove_PointCloud { /// Timestamp of point cloud var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Frame of reference - var frameID: String = .init() + var frameID: String = String() /// The origin of the point cloud relative to the frame of reference var pose: Foxglove_Pose { - get { _pose ?? Foxglove_Pose() } - set { _pose = newValue } + get {return _pose ?? Foxglove_Pose()} + set {_pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _pose != nil } + var hasPose: Bool {return self._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _pose = nil } + mutating func clearPose() {self._pose = nil} /// Number of bytes between points in the `data` var pointStride: UInt32 = 0 - /// Fields in `data`. At least 2 coordinate fields from `x`, `y`, and `z` are required for each point's position; - /// `red`, `green`, `blue`, and `alpha` are optional for customizing each point's color. + /// Fields in `data`. At least 2 coordinate fields from `x`, `y`, and `z` are required for each point's position; `red`, `green`, `blue`, and `alpha` are optional for customizing each point's color. var fields: [Foxglove_PackedElementField] = [] /// Point data, interpreted using `fields` - var data: Data = .init() + var data: Data = Data() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? - private var _pose: Foxglove_Pose? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + fileprivate var _pose: Foxglove_Pose? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_PointCloud: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_PointCloud: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_PointCloud: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_PointCloud: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".PointCloud" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -93,57 +87,57 @@ extension Foxglove_PointCloud: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl 6: .same(proto: "data"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularStringField(value: &frameID) - case 3: try decoder.decodeSingularMessageField(value: &_pose) - case 4: try decoder.decodeSingularFixed32Field(value: &pointStride) - case 5: try decoder.decodeRepeatedMessageField(value: &fields) - case 6: try decoder.decodeSingularBytesField(value: &data) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._pose) }() + case 4: try { try decoder.decodeSingularFixed32Field(value: &self.pointStride) }() + case 5: try { try decoder.decodeRepeatedMessageField(value: &self.fields) }() + case 6: try { try decoder.decodeSingularBytesField(value: &self.data) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - if !frameID.isEmpty { - try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) + } }() + if !self.frameID.isEmpty { + try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) } try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 3) } }() - if pointStride != 0 { - try visitor.visitSingularFixed32Field(value: pointStride, fieldNumber: 4) + if self.pointStride != 0 { + try visitor.visitSingularFixed32Field(value: self.pointStride, fieldNumber: 4) } - if !fields.isEmpty { - try visitor.visitRepeatedMessageField(value: fields, fieldNumber: 5) + if !self.fields.isEmpty { + try visitor.visitRepeatedMessageField(value: self.fields, fieldNumber: 5) } - if !data.isEmpty { - try visitor.visitSingularBytesField(value: data, fieldNumber: 6) + if !self.data.isEmpty { + try visitor.visitSingularBytesField(value: self.data, fieldNumber: 6) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_PointCloud, rhs: Foxglove_PointCloud) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.frameID != rhs.frameID { return false } - if lhs._pose != rhs._pose { return false } - if lhs.pointStride != rhs.pointStride { return false } - if lhs.fields != rhs.fields { return false } - if lhs.data != rhs.data { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_PointCloud, rhs: Foxglove_PointCloud) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.frameID != rhs.frameID {return false} + if lhs._pose != rhs._pose {return false} + if lhs.pointStride != rhs.pointStride {return false} + if lhs.fields != rhs.fields {return false} + if lhs.data != rhs.data {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/PointsAnnotation.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/PointsAnnotation.pb.swift index a9ccebe..4ed460b 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/PointsAnnotation.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/PointsAnnotation.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,14 +30,13 @@ struct Foxglove_PointsAnnotation { /// Timestamp of annotation var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Type of points annotation to draw var type: Foxglove_PointsAnnotation.TypeEnum = .unknown @@ -47,28 +46,26 @@ struct Foxglove_PointsAnnotation { /// Outline color var outlineColor: Foxglove_Color { - get { _outlineColor ?? Foxglove_Color() } - set { _outlineColor = newValue } + get {return _outlineColor ?? Foxglove_Color()} + set {_outlineColor = newValue} } - /// Returns true if `outlineColor` has been explicitly set. - var hasOutlineColor: Bool { _outlineColor != nil } + var hasOutlineColor: Bool {return self._outlineColor != nil} /// Clears the value of `outlineColor`. Subsequent reads from it will return its default value. - mutating func clearOutlineColor() { _outlineColor = nil } + mutating func clearOutlineColor() {self._outlineColor = nil} /// Per-point colors, if `type` is `POINTS`, or per-segment stroke colors, if `type` is `LINE_LIST`. var outlineColors: [Foxglove_Color] = [] /// Fill color var fillColor: Foxglove_Color { - get { _fillColor ?? Foxglove_Color() } - set { _fillColor = newValue } + get {return _fillColor ?? Foxglove_Color()} + set {_fillColor = newValue} } - /// Returns true if `fillColor` has been explicitly set. - var hasFillColor: Bool { _fillColor != nil } + var hasFillColor: Bool {return self._fillColor != nil} /// Clears the value of `fillColor`. Subsequent reads from it will return its default value. - mutating func clearFillColor() { _fillColor = nil } + mutating func clearFillColor() {self._fillColor = nil} /// Stroke thickness in pixels var thickness: Double = 0 @@ -110,50 +107,49 @@ struct Foxglove_PointsAnnotation { var rawValue: Int { switch self { - case .unknown: 0 - case .points: 1 - case .lineLoop: 2 - case .lineStrip: 3 - case .lineList: 4 - case let .UNRECOGNIZED(i): i + case .unknown: return 0 + case .points: return 1 + case .lineLoop: return 2 + case .lineStrip: return 3 + case .lineList: return 4 + case .UNRECOGNIZED(let i): return i } } + } init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? - private var _outlineColor: Foxglove_Color? - private var _fillColor: Foxglove_Color? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + fileprivate var _outlineColor: Foxglove_Color? = nil + fileprivate var _fillColor: Foxglove_Color? = nil } #if swift(>=4.2) - extension Foxglove_PointsAnnotation.TypeEnum: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_PointsAnnotation.TypeEnum] = [ - .unknown, - .points, - .lineLoop, - .lineStrip, - .lineList, - ] - } +extension Foxglove_PointsAnnotation.TypeEnum: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_PointsAnnotation.TypeEnum] = [ + .unknown, + .points, + .lineLoop, + .lineStrip, + .lineList, + ] +} -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_PointsAnnotation: @unchecked Sendable {} - extension Foxglove_PointsAnnotation.TypeEnum: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_PointsAnnotation: @unchecked Sendable {} +extension Foxglove_PointsAnnotation.TypeEnum: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_PointsAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_PointsAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".PointsAnnotation" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -165,62 +161,62 @@ extension Foxglove_PointsAnnotation: SwiftProtobuf.Message, SwiftProtobuf._Messa 7: .same(proto: "thickness"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularEnumField(value: &type) - case 3: try decoder.decodeRepeatedMessageField(value: &points) - case 4: try decoder.decodeSingularMessageField(value: &_outlineColor) - case 5: try decoder.decodeRepeatedMessageField(value: &outlineColors) - case 6: try decoder.decodeSingularMessageField(value: &_fillColor) - case 7: try decoder.decodeSingularDoubleField(value: &thickness) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self.type) }() + case 3: try { try decoder.decodeRepeatedMessageField(value: &self.points) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._outlineColor) }() + case 5: try { try decoder.decodeRepeatedMessageField(value: &self.outlineColors) }() + case 6: try { try decoder.decodeSingularMessageField(value: &self._fillColor) }() + case 7: try { try decoder.decodeSingularDoubleField(value: &self.thickness) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.type != .unknown { + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 2) } - if type != .unknown { - try visitor.visitSingularEnumField(value: type, fieldNumber: 2) - } - if !points.isEmpty { - try visitor.visitRepeatedMessageField(value: points, fieldNumber: 3) + if !self.points.isEmpty { + try visitor.visitRepeatedMessageField(value: self.points, fieldNumber: 3) } try { if let v = self._outlineColor { try visitor.visitSingularMessageField(value: v, fieldNumber: 4) } }() - if !outlineColors.isEmpty { - try visitor.visitRepeatedMessageField(value: outlineColors, fieldNumber: 5) + if !self.outlineColors.isEmpty { + try visitor.visitRepeatedMessageField(value: self.outlineColors, fieldNumber: 5) } try { if let v = self._fillColor { try visitor.visitSingularMessageField(value: v, fieldNumber: 6) } }() - if thickness != 0 { - try visitor.visitSingularDoubleField(value: thickness, fieldNumber: 7) + if self.thickness != 0 { + try visitor.visitSingularDoubleField(value: self.thickness, fieldNumber: 7) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_PointsAnnotation, rhs: Foxglove_PointsAnnotation) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.type != rhs.type { return false } - if lhs.points != rhs.points { return false } - if lhs._outlineColor != rhs._outlineColor { return false } - if lhs.outlineColors != rhs.outlineColors { return false } - if lhs._fillColor != rhs._fillColor { return false } - if lhs.thickness != rhs.thickness { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_PointsAnnotation, rhs: Foxglove_PointsAnnotation) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.type != rhs.type {return false} + if lhs.points != rhs.points {return false} + if lhs._outlineColor != rhs._outlineColor {return false} + if lhs.outlineColors != rhs.outlineColors {return false} + if lhs._fillColor != rhs._fillColor {return false} + if lhs.thickness != rhs.thickness {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Pose.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Pose.pb.swift index a38fc14..f049391 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Pose.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Pose.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,82 +30,78 @@ struct Foxglove_Pose { /// Point denoting position in 3D space var position: Foxglove_Vector3 { - get { _position ?? Foxglove_Vector3() } - set { _position = newValue } + get {return _position ?? Foxglove_Vector3()} + set {_position = newValue} } - /// Returns true if `position` has been explicitly set. - var hasPosition: Bool { _position != nil } + var hasPosition: Bool {return self._position != nil} /// Clears the value of `position`. Subsequent reads from it will return its default value. - mutating func clearPosition() { _position = nil } + mutating func clearPosition() {self._position = nil} /// Quaternion denoting orientation in 3D space var orientation: Foxglove_Quaternion { - get { _orientation ?? Foxglove_Quaternion() } - set { _orientation = newValue } + get {return _orientation ?? Foxglove_Quaternion()} + set {_orientation = newValue} } - /// Returns true if `orientation` has been explicitly set. - var hasOrientation: Bool { _orientation != nil } + var hasOrientation: Bool {return self._orientation != nil} /// Clears the value of `orientation`. Subsequent reads from it will return its default value. - mutating func clearOrientation() { _orientation = nil } + mutating func clearOrientation() {self._orientation = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _position: Foxglove_Vector3? - private var _orientation: Foxglove_Quaternion? + fileprivate var _position: Foxglove_Vector3? = nil + fileprivate var _orientation: Foxglove_Quaternion? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_Pose: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_Pose: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_Pose: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_Pose: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Pose" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "position"), 2: .same(proto: "orientation"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_position) - case 2: try decoder.decodeSingularMessageField(value: &_orientation) + case 1: try { try decoder.decodeSingularMessageField(value: &self._position) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._orientation) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _position { + try { if let v = self._position { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } + } }() try { if let v = self._orientation { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_Pose, rhs: Foxglove_Pose) -> Bool { - if lhs._position != rhs._position { return false } - if lhs._orientation != rhs._orientation { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_Pose, rhs: Foxglove_Pose) -> Bool { + if lhs._position != rhs._position {return false} + if lhs._orientation != rhs._orientation {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/PoseInFrame.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/PoseInFrame.pb.swift index 18e3359..b8a8916 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/PoseInFrame.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/PoseInFrame.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,48 +30,44 @@ struct Foxglove_PoseInFrame { /// Timestamp of pose var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Frame of reference for pose position and orientation - var frameID: String = .init() + var frameID: String = String() /// Pose in 3D space var pose: Foxglove_Pose { - get { _pose ?? Foxglove_Pose() } - set { _pose = newValue } + get {return _pose ?? Foxglove_Pose()} + set {_pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _pose != nil } + var hasPose: Bool {return self._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _pose = nil } + mutating func clearPose() {self._pose = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? - private var _pose: Foxglove_Pose? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + fileprivate var _pose: Foxglove_Pose? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_PoseInFrame: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_PoseInFrame: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_PoseInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_PoseInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".PoseInFrame" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -79,30 +75,30 @@ extension Foxglove_PoseInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImp 3: .same(proto: "pose"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularStringField(value: &frameID) - case 3: try decoder.decodeSingularMessageField(value: &_pose) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._pose) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - if !frameID.isEmpty { - try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) + } }() + if !self.frameID.isEmpty { + try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) } try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 3) @@ -110,11 +106,11 @@ extension Foxglove_PoseInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImp try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_PoseInFrame, rhs: Foxglove_PoseInFrame) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.frameID != rhs.frameID { return false } - if lhs._pose != rhs._pose { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_PoseInFrame, rhs: Foxglove_PoseInFrame) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.frameID != rhs.frameID {return false} + if lhs._pose != rhs._pose {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/PosesInFrame.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/PosesInFrame.pb.swift index e2001df..dd40226 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/PosesInFrame.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/PosesInFrame.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,17 +30,16 @@ struct Foxglove_PosesInFrame { /// Timestamp of pose var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Frame of reference for pose position and orientation - var frameID: String = .init() + var frameID: String = String() /// Poses in 3D space var poses: [Foxglove_Pose] = [] @@ -49,20 +48,18 @@ struct Foxglove_PosesInFrame { init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_PosesInFrame: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_PosesInFrame: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_PosesInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_PosesInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".PosesInFrame" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -70,42 +67,42 @@ extension Foxglove_PosesInFrame: SwiftProtobuf.Message, SwiftProtobuf._MessageIm 3: .same(proto: "poses"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularStringField(value: &frameID) - case 3: try decoder.decodeRepeatedMessageField(value: &poses) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() + case 3: try { try decoder.decodeRepeatedMessageField(value: &self.poses) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.frameID.isEmpty { + try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) } - if !frameID.isEmpty { - try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) - } - if !poses.isEmpty { - try visitor.visitRepeatedMessageField(value: poses, fieldNumber: 3) + if !self.poses.isEmpty { + try visitor.visitRepeatedMessageField(value: self.poses, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_PosesInFrame, rhs: Foxglove_PosesInFrame) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.frameID != rhs.frameID { return false } - if lhs.poses != rhs.poses { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_PosesInFrame, rhs: Foxglove_PosesInFrame) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.frameID != rhs.frameID {return false} + if lhs.poses != rhs.poses {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Quaternion.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Quaternion.pb.swift index ffbbff1..3fa5cad 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Quaternion.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Quaternion.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -46,16 +46,14 @@ struct Foxglove_Quaternion { } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_Quaternion: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_Quaternion: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_Quaternion: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_Quaternion: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Quaternion" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "x"), @@ -64,43 +62,43 @@ extension Foxglove_Quaternion: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl 4: .same(proto: "w"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularDoubleField(value: &x) - case 2: try decoder.decodeSingularDoubleField(value: &y) - case 3: try decoder.decodeSingularDoubleField(value: &z) - case 4: try decoder.decodeSingularDoubleField(value: &w) + case 1: try { try decoder.decodeSingularDoubleField(value: &self.x) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.y) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.z) }() + case 4: try { try decoder.decodeSingularDoubleField(value: &self.w) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if x != 0 { - try visitor.visitSingularDoubleField(value: x, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if self.x != 0 { + try visitor.visitSingularDoubleField(value: self.x, fieldNumber: 1) } - if y != 0 { - try visitor.visitSingularDoubleField(value: y, fieldNumber: 2) + if self.y != 0 { + try visitor.visitSingularDoubleField(value: self.y, fieldNumber: 2) } - if z != 0 { - try visitor.visitSingularDoubleField(value: z, fieldNumber: 3) + if self.z != 0 { + try visitor.visitSingularDoubleField(value: self.z, fieldNumber: 3) } - if w != 0 { - try visitor.visitSingularDoubleField(value: w, fieldNumber: 4) + if self.w != 0 { + try visitor.visitSingularDoubleField(value: self.w, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_Quaternion, rhs: Foxglove_Quaternion) -> Bool { - if lhs.x != rhs.x { return false } - if lhs.y != rhs.y { return false } - if lhs.z != rhs.z { return false } - if lhs.w != rhs.w { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_Quaternion, rhs: Foxglove_Quaternion) -> Bool { + if lhs.x != rhs.x {return false} + if lhs.y != rhs.y {return false} + if lhs.z != rhs.z {return false} + if lhs.w != rhs.w {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/RawImage.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/RawImage.pb.swift index 487dadf..f02408d 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/RawImage.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/RawImage.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,18 +30,16 @@ struct Foxglove_RawImage { /// Timestamp of image var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} - /// Frame of reference for the image. The origin of the frame is the optical center of the camera. +x points to the - /// right in the image, +y points down, and +z points into the plane of the image. - var frameID: String = .init() + /// Frame of reference for the image. The origin of the frame is the optical center of the camera. +x points to the right in the image, +y points down, and +z points into the plane of the image. + var frameID: String = String() /// Image width var width: UInt32 = 0 @@ -50,35 +48,32 @@ struct Foxglove_RawImage { var height: UInt32 = 0 /// Encoding of the raw image data - /// - /// Supported values: `8UC1`, `8UC3`, `16UC1`, `32FC1`, `bayer_bggr8`, `bayer_gbrg8`, `bayer_grbg8`, `bayer_rggb8`, - /// `bgr8`, `bgra8`, `mono8`, `mono16`, `rgb8`, `rgba8`, `uyvy` or `yuv422`, `yuyv` or `yuv422_yuy2` - var encoding: String = .init() + /// + /// Supported values: `8UC1`, `8UC3`, `16UC1`, `32FC1`, `bayer_bggr8`, `bayer_gbrg8`, `bayer_grbg8`, `bayer_rggb8`, `bgr8`, `bgra8`, `mono8`, `mono16`, `rgb8`, `rgba8`, `uyvy` or `yuv422`, `yuyv` or `yuv422_yuy2` + var encoding: String = String() /// Byte length of a single row var step: UInt32 = 0 /// Raw image data - var data: Data = .init() + var data: Data = Data() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_RawImage: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_RawImage: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_RawImage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_RawImage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".RawImage" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -90,62 +85,62 @@ extension Foxglove_RawImage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem 6: .same(proto: "data"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularFixed32Field(value: &width) - case 3: try decoder.decodeSingularFixed32Field(value: &height) - case 4: try decoder.decodeSingularStringField(value: &encoding) - case 5: try decoder.decodeSingularFixed32Field(value: &step) - case 6: try decoder.decodeSingularBytesField(value: &data) - case 7: try decoder.decodeSingularStringField(value: &frameID) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularFixed32Field(value: &self.width) }() + case 3: try { try decoder.decodeSingularFixed32Field(value: &self.height) }() + case 4: try { try decoder.decodeSingularStringField(value: &self.encoding) }() + case 5: try { try decoder.decodeSingularFixed32Field(value: &self.step) }() + case 6: try { try decoder.decodeSingularBytesField(value: &self.data) }() + case 7: try { try decoder.decodeSingularStringField(value: &self.frameID) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.width != 0 { + try visitor.visitSingularFixed32Field(value: self.width, fieldNumber: 2) } - if width != 0 { - try visitor.visitSingularFixed32Field(value: width, fieldNumber: 2) - } - if height != 0 { - try visitor.visitSingularFixed32Field(value: height, fieldNumber: 3) + if self.height != 0 { + try visitor.visitSingularFixed32Field(value: self.height, fieldNumber: 3) } - if !encoding.isEmpty { - try visitor.visitSingularStringField(value: encoding, fieldNumber: 4) + if !self.encoding.isEmpty { + try visitor.visitSingularStringField(value: self.encoding, fieldNumber: 4) } - if step != 0 { - try visitor.visitSingularFixed32Field(value: step, fieldNumber: 5) + if self.step != 0 { + try visitor.visitSingularFixed32Field(value: self.step, fieldNumber: 5) } - if !data.isEmpty { - try visitor.visitSingularBytesField(value: data, fieldNumber: 6) + if !self.data.isEmpty { + try visitor.visitSingularBytesField(value: self.data, fieldNumber: 6) } - if !frameID.isEmpty { - try visitor.visitSingularStringField(value: frameID, fieldNumber: 7) + if !self.frameID.isEmpty { + try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 7) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_RawImage, rhs: Foxglove_RawImage) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.frameID != rhs.frameID { return false } - if lhs.width != rhs.width { return false } - if lhs.height != rhs.height { return false } - if lhs.encoding != rhs.encoding { return false } - if lhs.step != rhs.step { return false } - if lhs.data != rhs.data { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_RawImage, rhs: Foxglove_RawImage) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.frameID != rhs.frameID {return false} + if lhs.width != rhs.width {return false} + if lhs.height != rhs.height {return false} + if lhs.encoding != rhs.encoding {return false} + if lhs.step != rhs.step {return false} + if lhs.data != rhs.data {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/SceneEntity.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/SceneEntity.pb.swift index dc51093..55364d3 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/SceneEntity.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/SceneEntity.pb.swift @@ -17,13 +17,12 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } -/// A visual element in a 3D scene. An entity may be composed of multiple primitives which all share the same frame of -/// reference. +/// A visual element in a 3D scene. An entity may be composed of multiple primitives which all share the same frame of reference. struct Foxglove_SceneEntity { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -31,35 +30,31 @@ struct Foxglove_SceneEntity { /// Timestamp of the entity var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Frame of reference - var frameID: String = .init() + var frameID: String = String() /// Identifier for the entity. A entity will replace any prior entity on the same topic with the same `id`. - var id: String = .init() + var id: String = String() - /// Length of time (relative to `timestamp`) after which the entity should be automatically removed. Zero value - /// indicates the entity should remain visible until it is replaced or deleted. + /// Length of time (relative to `timestamp`) after which the entity should be automatically removed. Zero value indicates the entity should remain visible until it is replaced or deleted. var lifetime: SwiftProtobuf.Google_Protobuf_Duration { - get { _lifetime ?? SwiftProtobuf.Google_Protobuf_Duration() } - set { _lifetime = newValue } + get {return _lifetime ?? SwiftProtobuf.Google_Protobuf_Duration()} + set {_lifetime = newValue} } - /// Returns true if `lifetime` has been explicitly set. - var hasLifetime: Bool { _lifetime != nil } + var hasLifetime: Bool {return self._lifetime != nil} /// Clears the value of `lifetime`. Subsequent reads from it will return its default value. - mutating func clearLifetime() { _lifetime = nil } + mutating func clearLifetime() {self._lifetime = nil} - /// Whether the entity should keep its location in the fixed frame (false) or follow the frame specified in `frame_id` - /// as it moves relative to the fixed frame (true) + /// Whether the entity should keep its location in the fixed frame (false) or follow the frame specified in `frame_id` as it moves relative to the fixed frame (true) var frameLocked: Bool = false /// Additional user-provided metadata associated with the entity. Keys must be unique. @@ -93,21 +88,19 @@ struct Foxglove_SceneEntity { init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? - private var _lifetime: SwiftProtobuf.Google_Protobuf_Duration? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + fileprivate var _lifetime: SwiftProtobuf.Google_Protobuf_Duration? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_SceneEntity: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_SceneEntity: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_SceneEntity: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_SceneEntity: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".SceneEntity" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -126,97 +119,97 @@ extension Foxglove_SceneEntity: SwiftProtobuf.Message, SwiftProtobuf._MessageImp 14: .same(proto: "models"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularStringField(value: &frameID) - case 3: try decoder.decodeSingularStringField(value: &id) - case 4: try decoder.decodeSingularMessageField(value: &_lifetime) - case 5: try decoder.decodeSingularBoolField(value: &frameLocked) - case 6: try decoder.decodeRepeatedMessageField(value: &metadata) - case 7: try decoder.decodeRepeatedMessageField(value: &arrows) - case 8: try decoder.decodeRepeatedMessageField(value: &cubes) - case 9: try decoder.decodeRepeatedMessageField(value: &spheres) - case 10: try decoder.decodeRepeatedMessageField(value: &cylinders) - case 11: try decoder.decodeRepeatedMessageField(value: &lines) - case 12: try decoder.decodeRepeatedMessageField(value: &triangles) - case 13: try decoder.decodeRepeatedMessageField(value: &texts) - case 14: try decoder.decodeRepeatedMessageField(value: &models) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.frameID) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.id) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._lifetime) }() + case 5: try { try decoder.decodeSingularBoolField(value: &self.frameLocked) }() + case 6: try { try decoder.decodeRepeatedMessageField(value: &self.metadata) }() + case 7: try { try decoder.decodeRepeatedMessageField(value: &self.arrows) }() + case 8: try { try decoder.decodeRepeatedMessageField(value: &self.cubes) }() + case 9: try { try decoder.decodeRepeatedMessageField(value: &self.spheres) }() + case 10: try { try decoder.decodeRepeatedMessageField(value: &self.cylinders) }() + case 11: try { try decoder.decodeRepeatedMessageField(value: &self.lines) }() + case 12: try { try decoder.decodeRepeatedMessageField(value: &self.triangles) }() + case 13: try { try decoder.decodeRepeatedMessageField(value: &self.texts) }() + case 14: try { try decoder.decodeRepeatedMessageField(value: &self.models) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.frameID.isEmpty { + try visitor.visitSingularStringField(value: self.frameID, fieldNumber: 2) } - if !frameID.isEmpty { - try visitor.visitSingularStringField(value: frameID, fieldNumber: 2) - } - if !id.isEmpty { - try visitor.visitSingularStringField(value: id, fieldNumber: 3) + if !self.id.isEmpty { + try visitor.visitSingularStringField(value: self.id, fieldNumber: 3) } try { if let v = self._lifetime { try visitor.visitSingularMessageField(value: v, fieldNumber: 4) } }() - if frameLocked != false { - try visitor.visitSingularBoolField(value: frameLocked, fieldNumber: 5) + if self.frameLocked != false { + try visitor.visitSingularBoolField(value: self.frameLocked, fieldNumber: 5) } - if !metadata.isEmpty { - try visitor.visitRepeatedMessageField(value: metadata, fieldNumber: 6) + if !self.metadata.isEmpty { + try visitor.visitRepeatedMessageField(value: self.metadata, fieldNumber: 6) } - if !arrows.isEmpty { - try visitor.visitRepeatedMessageField(value: arrows, fieldNumber: 7) + if !self.arrows.isEmpty { + try visitor.visitRepeatedMessageField(value: self.arrows, fieldNumber: 7) } - if !cubes.isEmpty { - try visitor.visitRepeatedMessageField(value: cubes, fieldNumber: 8) + if !self.cubes.isEmpty { + try visitor.visitRepeatedMessageField(value: self.cubes, fieldNumber: 8) } - if !spheres.isEmpty { - try visitor.visitRepeatedMessageField(value: spheres, fieldNumber: 9) + if !self.spheres.isEmpty { + try visitor.visitRepeatedMessageField(value: self.spheres, fieldNumber: 9) } - if !cylinders.isEmpty { - try visitor.visitRepeatedMessageField(value: cylinders, fieldNumber: 10) + if !self.cylinders.isEmpty { + try visitor.visitRepeatedMessageField(value: self.cylinders, fieldNumber: 10) } - if !lines.isEmpty { - try visitor.visitRepeatedMessageField(value: lines, fieldNumber: 11) + if !self.lines.isEmpty { + try visitor.visitRepeatedMessageField(value: self.lines, fieldNumber: 11) } - if !triangles.isEmpty { - try visitor.visitRepeatedMessageField(value: triangles, fieldNumber: 12) + if !self.triangles.isEmpty { + try visitor.visitRepeatedMessageField(value: self.triangles, fieldNumber: 12) } - if !texts.isEmpty { - try visitor.visitRepeatedMessageField(value: texts, fieldNumber: 13) + if !self.texts.isEmpty { + try visitor.visitRepeatedMessageField(value: self.texts, fieldNumber: 13) } - if !models.isEmpty { - try visitor.visitRepeatedMessageField(value: models, fieldNumber: 14) + if !self.models.isEmpty { + try visitor.visitRepeatedMessageField(value: self.models, fieldNumber: 14) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_SceneEntity, rhs: Foxglove_SceneEntity) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.frameID != rhs.frameID { return false } - if lhs.id != rhs.id { return false } - if lhs._lifetime != rhs._lifetime { return false } - if lhs.frameLocked != rhs.frameLocked { return false } - if lhs.metadata != rhs.metadata { return false } - if lhs.arrows != rhs.arrows { return false } - if lhs.cubes != rhs.cubes { return false } - if lhs.spheres != rhs.spheres { return false } - if lhs.cylinders != rhs.cylinders { return false } - if lhs.lines != rhs.lines { return false } - if lhs.triangles != rhs.triangles { return false } - if lhs.texts != rhs.texts { return false } - if lhs.models != rhs.models { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_SceneEntity, rhs: Foxglove_SceneEntity) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.frameID != rhs.frameID {return false} + if lhs.id != rhs.id {return false} + if lhs._lifetime != rhs._lifetime {return false} + if lhs.frameLocked != rhs.frameLocked {return false} + if lhs.metadata != rhs.metadata {return false} + if lhs.arrows != rhs.arrows {return false} + if lhs.cubes != rhs.cubes {return false} + if lhs.spheres != rhs.spheres {return false} + if lhs.cylinders != rhs.cylinders {return false} + if lhs.lines != rhs.lines {return false} + if lhs.triangles != rhs.triangles {return false} + if lhs.texts != rhs.texts {return false} + if lhs.models != rhs.models {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/SceneEntityDeletion.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/SceneEntityDeletion.pb.swift index 6fbfc0d..a783ce5 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/SceneEntityDeletion.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/SceneEntityDeletion.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,20 +30,19 @@ struct Foxglove_SceneEntityDeletion { /// Timestamp of the deletion. Only matching entities earlier than this timestamp will be deleted. var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Type of deletion action to perform var type: Foxglove_SceneEntityDeletion.TypeEnum = .matchingID /// Identifier which must match if `type` is `MATCHING_ID`. - var id: String = .init() + var id: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() @@ -72,42 +71,41 @@ struct Foxglove_SceneEntityDeletion { var rawValue: Int { switch self { - case .matchingID: 0 - case .all: 1 - case let .UNRECOGNIZED(i): i + case .matchingID: return 0 + case .all: return 1 + case .UNRECOGNIZED(let i): return i } } + } init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil } #if swift(>=4.2) - extension Foxglove_SceneEntityDeletion.TypeEnum: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Foxglove_SceneEntityDeletion.TypeEnum] = [ - .matchingID, - .all, - ] - } +extension Foxglove_SceneEntityDeletion.TypeEnum: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Foxglove_SceneEntityDeletion.TypeEnum] = [ + .matchingID, + .all, + ] +} -#endif // swift(>=4.2) +#endif // swift(>=4.2) #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_SceneEntityDeletion: @unchecked Sendable {} - extension Foxglove_SceneEntityDeletion.TypeEnum: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_SceneEntityDeletion: @unchecked Sendable {} +extension Foxglove_SceneEntityDeletion.TypeEnum: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_SceneEntityDeletion: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_SceneEntityDeletion: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".SceneEntityDeletion" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -115,42 +113,42 @@ extension Foxglove_SceneEntityDeletion: SwiftProtobuf.Message, SwiftProtobuf._Me 3: .same(proto: "id"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularEnumField(value: &type) - case 3: try decoder.decodeSingularStringField(value: &id) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self.type) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.id) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.type != .matchingID { + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 2) } - if type != .matchingID { - try visitor.visitSingularEnumField(value: type, fieldNumber: 2) - } - if !id.isEmpty { - try visitor.visitSingularStringField(value: id, fieldNumber: 3) + if !self.id.isEmpty { + try visitor.visitSingularStringField(value: self.id, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_SceneEntityDeletion, rhs: Foxglove_SceneEntityDeletion) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs.type != rhs.type { return false } - if lhs.id != rhs.id { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_SceneEntityDeletion, rhs: Foxglove_SceneEntityDeletion) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.type != rhs.type {return false} + if lhs.id != rhs.id {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/SceneUpdate.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/SceneUpdate.pb.swift index f77eb12..a80d8d0 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/SceneUpdate.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/SceneUpdate.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -40,49 +40,47 @@ struct Foxglove_SceneUpdate { } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_SceneUpdate: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_SceneUpdate: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_SceneUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_SceneUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".SceneUpdate" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "deletions"), 2: .same(proto: "entities"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeRepeatedMessageField(value: &deletions) - case 2: try decoder.decodeRepeatedMessageField(value: &entities) + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.deletions) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.entities) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if !deletions.isEmpty { - try visitor.visitRepeatedMessageField(value: deletions, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if !self.deletions.isEmpty { + try visitor.visitRepeatedMessageField(value: self.deletions, fieldNumber: 1) } - if !entities.isEmpty { - try visitor.visitRepeatedMessageField(value: entities, fieldNumber: 2) + if !self.entities.isEmpty { + try visitor.visitRepeatedMessageField(value: self.entities, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_SceneUpdate, rhs: Foxglove_SceneUpdate) -> Bool { - if lhs.deletions != rhs.deletions { return false } - if lhs.entities != rhs.entities { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_SceneUpdate, rhs: Foxglove_SceneUpdate) -> Bool { + if lhs.deletions != rhs.deletions {return false} + if lhs.entities != rhs.entities {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/SpherePrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/SpherePrimitive.pb.swift index e245750..288c084 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/SpherePrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/SpherePrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,57 +30,52 @@ struct Foxglove_SpherePrimitive { /// Position of the center of the sphere and orientation of the sphere var pose: Foxglove_Pose { - get { _pose ?? Foxglove_Pose() } - set { _pose = newValue } + get {return _pose ?? Foxglove_Pose()} + set {_pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _pose != nil } + var hasPose: Bool {return self._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _pose = nil } + mutating func clearPose() {self._pose = nil} /// Size (diameter) of the sphere along each axis var size: Foxglove_Vector3 { - get { _size ?? Foxglove_Vector3() } - set { _size = newValue } + get {return _size ?? Foxglove_Vector3()} + set {_size = newValue} } - /// Returns true if `size` has been explicitly set. - var hasSize: Bool { _size != nil } + var hasSize: Bool {return self._size != nil} /// Clears the value of `size`. Subsequent reads from it will return its default value. - mutating func clearSize() { _size = nil } + mutating func clearSize() {self._size = nil} /// Color of the sphere var color: Foxglove_Color { - get { _color ?? Foxglove_Color() } - set { _color = newValue } + get {return _color ?? Foxglove_Color()} + set {_color = newValue} } - /// Returns true if `color` has been explicitly set. - var hasColor: Bool { _color != nil } + var hasColor: Bool {return self._color != nil} /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() { _color = nil } + mutating func clearColor() {self._color = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _pose: Foxglove_Pose? - private var _size: Foxglove_Vector3? - private var _color: Foxglove_Color? + fileprivate var _pose: Foxglove_Pose? = nil + fileprivate var _size: Foxglove_Vector3? = nil + fileprivate var _color: Foxglove_Color? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_SpherePrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_SpherePrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_SpherePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_SpherePrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".SpherePrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -88,28 +83,28 @@ extension Foxglove_SpherePrimitive: SwiftProtobuf.Message, SwiftProtobuf._Messag 3: .same(proto: "color"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_pose) - case 2: try decoder.decodeSingularMessageField(value: &_size) - case 3: try decoder.decodeSingularMessageField(value: &_color) + case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._size) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._color) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _pose { + try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } + } }() try { if let v = self._size { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() @@ -119,11 +114,11 @@ extension Foxglove_SpherePrimitive: SwiftProtobuf.Message, SwiftProtobuf._Messag try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_SpherePrimitive, rhs: Foxglove_SpherePrimitive) -> Bool { - if lhs._pose != rhs._pose { return false } - if lhs._size != rhs._size { return false } - if lhs._color != rhs._color { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_SpherePrimitive, rhs: Foxglove_SpherePrimitive) -> Bool { + if lhs._pose != rhs._pose {return false} + if lhs._size != rhs._size {return false} + if lhs._color != rhs._color {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/TextAnnotation.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/TextAnnotation.pb.swift index c79131e..e463ec0 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/TextAnnotation.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/TextAnnotation.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,75 +30,69 @@ struct Foxglove_TextAnnotation { /// Timestamp of annotation var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get { _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp() } - set { _timestamp = newValue } + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool { _timestamp != nil } + var hasTimestamp: Bool {return self._timestamp != nil} /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() { _timestamp = nil } + mutating func clearTimestamp() {self._timestamp = nil} /// Bottom-left origin of the text label in 2D image coordinates (pixels) var position: Foxglove_Point2 { - get { _position ?? Foxglove_Point2() } - set { _position = newValue } + get {return _position ?? Foxglove_Point2()} + set {_position = newValue} } - /// Returns true if `position` has been explicitly set. - var hasPosition: Bool { _position != nil } + var hasPosition: Bool {return self._position != nil} /// Clears the value of `position`. Subsequent reads from it will return its default value. - mutating func clearPosition() { _position = nil } + mutating func clearPosition() {self._position = nil} /// Text to display - var text: String = .init() + var text: String = String() /// Font size in pixels var fontSize: Double = 0 /// Text color var textColor: Foxglove_Color { - get { _textColor ?? Foxglove_Color() } - set { _textColor = newValue } + get {return _textColor ?? Foxglove_Color()} + set {_textColor = newValue} } - /// Returns true if `textColor` has been explicitly set. - var hasTextColor: Bool { _textColor != nil } + var hasTextColor: Bool {return self._textColor != nil} /// Clears the value of `textColor`. Subsequent reads from it will return its default value. - mutating func clearTextColor() { _textColor = nil } + mutating func clearTextColor() {self._textColor = nil} /// Background fill color var backgroundColor: Foxglove_Color { - get { _backgroundColor ?? Foxglove_Color() } - set { _backgroundColor = newValue } + get {return _backgroundColor ?? Foxglove_Color()} + set {_backgroundColor = newValue} } - /// Returns true if `backgroundColor` has been explicitly set. - var hasBackgroundColor: Bool { _backgroundColor != nil } + var hasBackgroundColor: Bool {return self._backgroundColor != nil} /// Clears the value of `backgroundColor`. Subsequent reads from it will return its default value. - mutating func clearBackgroundColor() { _backgroundColor = nil } + mutating func clearBackgroundColor() {self._backgroundColor = nil} var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? - private var _position: Foxglove_Point2? - private var _textColor: Foxglove_Color? - private var _backgroundColor: Foxglove_Color? + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + fileprivate var _position: Foxglove_Point2? = nil + fileprivate var _textColor: Foxglove_Color? = nil + fileprivate var _backgroundColor: Foxglove_Color? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_TextAnnotation: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_TextAnnotation: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_TextAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_TextAnnotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".TextAnnotation" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "timestamp"), @@ -109,39 +103,39 @@ extension Foxglove_TextAnnotation: SwiftProtobuf.Message, SwiftProtobuf._Message 6: .standard(proto: "background_color"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_timestamp) - case 2: try decoder.decodeSingularMessageField(value: &_position) - case 3: try decoder.decodeSingularStringField(value: &text) - case 4: try decoder.decodeSingularDoubleField(value: &fontSize) - case 5: try decoder.decodeSingularMessageField(value: &_textColor) - case 6: try decoder.decodeSingularMessageField(value: &_backgroundColor) + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._position) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.text) }() + case 4: try { try decoder.decodeSingularDoubleField(value: &self.fontSize) }() + case 5: try { try decoder.decodeSingularMessageField(value: &self._textColor) }() + case 6: try { try decoder.decodeSingularMessageField(value: &self._backgroundColor) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _timestamp { + try { if let v = self._timestamp { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } + } }() try { if let v = self._position { try visitor.visitSingularMessageField(value: v, fieldNumber: 2) } }() - if !text.isEmpty { - try visitor.visitSingularStringField(value: text, fieldNumber: 3) + if !self.text.isEmpty { + try visitor.visitSingularStringField(value: self.text, fieldNumber: 3) } - if fontSize != 0 { - try visitor.visitSingularDoubleField(value: fontSize, fieldNumber: 4) + if self.fontSize != 0 { + try visitor.visitSingularDoubleField(value: self.fontSize, fieldNumber: 4) } try { if let v = self._textColor { try visitor.visitSingularMessageField(value: v, fieldNumber: 5) @@ -152,14 +146,14 @@ extension Foxglove_TextAnnotation: SwiftProtobuf.Message, SwiftProtobuf._Message try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_TextAnnotation, rhs: Foxglove_TextAnnotation) -> Bool { - if lhs._timestamp != rhs._timestamp { return false } - if lhs._position != rhs._position { return false } - if lhs.text != rhs.text { return false } - if lhs.fontSize != rhs.fontSize { return false } - if lhs._textColor != rhs._textColor { return false } - if lhs._backgroundColor != rhs._backgroundColor { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_TextAnnotation, rhs: Foxglove_TextAnnotation) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs._position != rhs._position {return false} + if lhs.text != rhs.text {return false} + if lhs.fontSize != rhs.fontSize {return false} + if lhs._textColor != rhs._textColor {return false} + if lhs._backgroundColor != rhs._backgroundColor {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/TextPrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/TextPrimitive.pb.swift index 1470186..56d96db 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/TextPrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/TextPrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -28,17 +28,15 @@ struct Foxglove_TextPrimitive { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - /// Position of the center of the text box and orientation of the text. Identity orientation means the text is - /// oriented in the xy-plane and flows from -x to +x. + /// Position of the center of the text box and orientation of the text. Identity orientation means the text is oriented in the xy-plane and flows from -x to +x. var pose: Foxglove_Pose { - get { _pose ?? Foxglove_Pose() } - set { _pose = newValue } + get {return _pose ?? Foxglove_Pose()} + set {_pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _pose != nil } + var hasPose: Bool {return self._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _pose = nil } + mutating func clearPose() {self._pose = nil} /// Whether the text should respect `pose.orientation` (false) or always face the camera (true) var billboard: Bool = false @@ -46,43 +44,39 @@ struct Foxglove_TextPrimitive { /// Font size (height of one line of text) var fontSize: Double = 0 - /// Indicates whether `font_size` is a fixed size in screen pixels (true), or specified in world coordinates and - /// scales with distance from the camera (false) + /// Indicates whether `font_size` is a fixed size in screen pixels (true), or specified in world coordinates and scales with distance from the camera (false) var scaleInvariant: Bool = false /// Color of the text var color: Foxglove_Color { - get { _color ?? Foxglove_Color() } - set { _color = newValue } + get {return _color ?? Foxglove_Color()} + set {_color = newValue} } - /// Returns true if `color` has been explicitly set. - var hasColor: Bool { _color != nil } + var hasColor: Bool {return self._color != nil} /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() { _color = nil } + mutating func clearColor() {self._color = nil} /// Text - var text: String = .init() + var text: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _pose: Foxglove_Pose? - private var _color: Foxglove_Color? + fileprivate var _pose: Foxglove_Pose? = nil + fileprivate var _color: Foxglove_Color? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_TextPrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_TextPrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_TextPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_TextPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".TextPrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -93,57 +87,57 @@ extension Foxglove_TextPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageI 6: .same(proto: "text"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_pose) - case 2: try decoder.decodeSingularBoolField(value: &billboard) - case 3: try decoder.decodeSingularDoubleField(value: &fontSize) - case 4: try decoder.decodeSingularBoolField(value: &scaleInvariant) - case 5: try decoder.decodeSingularMessageField(value: &_color) - case 6: try decoder.decodeSingularStringField(value: &text) + case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() + case 2: try { try decoder.decodeSingularBoolField(value: &self.billboard) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.fontSize) }() + case 4: try { try decoder.decodeSingularBoolField(value: &self.scaleInvariant) }() + case 5: try { try decoder.decodeSingularMessageField(value: &self._color) }() + case 6: try { try decoder.decodeSingularStringField(value: &self.text) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _pose { + try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.billboard != false { + try visitor.visitSingularBoolField(value: self.billboard, fieldNumber: 2) } - if billboard != false { - try visitor.visitSingularBoolField(value: billboard, fieldNumber: 2) - } - if fontSize != 0 { - try visitor.visitSingularDoubleField(value: fontSize, fieldNumber: 3) + if self.fontSize != 0 { + try visitor.visitSingularDoubleField(value: self.fontSize, fieldNumber: 3) } - if scaleInvariant != false { - try visitor.visitSingularBoolField(value: scaleInvariant, fieldNumber: 4) + if self.scaleInvariant != false { + try visitor.visitSingularBoolField(value: self.scaleInvariant, fieldNumber: 4) } try { if let v = self._color { try visitor.visitSingularMessageField(value: v, fieldNumber: 5) } }() - if !text.isEmpty { - try visitor.visitSingularStringField(value: text, fieldNumber: 6) + if !self.text.isEmpty { + try visitor.visitSingularStringField(value: self.text, fieldNumber: 6) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_TextPrimitive, rhs: Foxglove_TextPrimitive) -> Bool { - if lhs._pose != rhs._pose { return false } - if lhs.billboard != rhs.billboard { return false } - if lhs.fontSize != rhs.fontSize { return false } - if lhs.scaleInvariant != rhs.scaleInvariant { return false } - if lhs._color != rhs._color { return false } - if lhs.text != rhs.text { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_TextPrimitive, rhs: Foxglove_TextPrimitive) -> Bool { + if lhs._pose != rhs._pose {return false} + if lhs.billboard != rhs.billboard {return false} + if lhs.fontSize != rhs.fontSize {return false} + if lhs.scaleInvariant != rhs.scaleInvariant {return false} + if lhs._color != rhs._color {return false} + if lhs.text != rhs.text {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/TriangleListPrimitive.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/TriangleListPrimitive.pb.swift index e70068c..82f033e 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/TriangleListPrimitive.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/TriangleListPrimitive.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -30,58 +30,52 @@ struct Foxglove_TriangleListPrimitive { /// Origin of triangles relative to reference frame var pose: Foxglove_Pose { - get { _pose ?? Foxglove_Pose() } - set { _pose = newValue } + get {return _pose ?? Foxglove_Pose()} + set {_pose = newValue} } - /// Returns true if `pose` has been explicitly set. - var hasPose: Bool { _pose != nil } + var hasPose: Bool {return self._pose != nil} /// Clears the value of `pose`. Subsequent reads from it will return its default value. - mutating func clearPose() { _pose = nil } + mutating func clearPose() {self._pose = nil} /// Vertices to use for triangles, interpreted as a list of triples (0-1-2, 3-4-5, ...) var points: [Foxglove_Point3] = [] /// Solid color to use for the whole shape. One of `color` or `colors` must be provided. var color: Foxglove_Color { - get { _color ?? Foxglove_Color() } - set { _color = newValue } + get {return _color ?? Foxglove_Color()} + set {_color = newValue} } - /// Returns true if `color` has been explicitly set. - var hasColor: Bool { _color != nil } + var hasColor: Bool {return self._color != nil} /// Clears the value of `color`. Subsequent reads from it will return its default value. - mutating func clearColor() { _color = nil } + mutating func clearColor() {self._color = nil} - /// Per-vertex colors (if specified, must have the same length as `points`). One of `color` or `colors` must be - /// provided. + /// Per-vertex colors (if specified, must have the same length as `points`). One of `color` or `colors` must be provided. var colors: [Foxglove_Color] = [] /// Indices into the `points` and `colors` attribute arrays, which can be used to avoid duplicating attribute data. - /// - /// If omitted or empty, indexing will not be used. This default behavior is equivalent to specifying [0, 1, ..., N-1] - /// for the indices (where N is the number of `points` provided). + /// + /// If omitted or empty, indexing will not be used. This default behavior is equivalent to specifying [0, 1, ..., N-1] for the indices (where N is the number of `points` provided). var indices: [UInt32] = [] var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - private var _pose: Foxglove_Pose? - private var _color: Foxglove_Color? + fileprivate var _pose: Foxglove_Pose? = nil + fileprivate var _color: Foxglove_Color? = nil } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_TriangleListPrimitive: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_TriangleListPrimitive: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_TriangleListPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_TriangleListPrimitive: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".TriangleListPrimitive" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pose"), @@ -91,52 +85,52 @@ extension Foxglove_TriangleListPrimitive: SwiftProtobuf.Message, SwiftProtobuf._ 5: .same(proto: "indices"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_pose) - case 2: try decoder.decodeRepeatedMessageField(value: &points) - case 3: try decoder.decodeSingularMessageField(value: &_color) - case 4: try decoder.decodeRepeatedMessageField(value: &colors) - case 5: try decoder.decodeRepeatedFixed32Field(value: &indices) + case 1: try { try decoder.decodeSingularMessageField(value: &self._pose) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.points) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._color) }() + case 4: try { try decoder.decodeRepeatedMessageField(value: &self.colors) }() + case 5: try { try decoder.decodeRepeatedFixed32Field(value: &self.indices) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { + func traverse(visitor: inout V) throws { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every if/case branch local when no optimizations // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and // https://github.com/apple/swift-protobuf/issues/1182 - if let v = _pose { + try { if let v = self._pose { try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - if !points.isEmpty { - try visitor.visitRepeatedMessageField(value: points, fieldNumber: 2) + } }() + if !self.points.isEmpty { + try visitor.visitRepeatedMessageField(value: self.points, fieldNumber: 2) } try { if let v = self._color { try visitor.visitSingularMessageField(value: v, fieldNumber: 3) } }() - if !colors.isEmpty { - try visitor.visitRepeatedMessageField(value: colors, fieldNumber: 4) + if !self.colors.isEmpty { + try visitor.visitRepeatedMessageField(value: self.colors, fieldNumber: 4) } - if !indices.isEmpty { - try visitor.visitPackedFixed32Field(value: indices, fieldNumber: 5) + if !self.indices.isEmpty { + try visitor.visitPackedFixed32Field(value: self.indices, fieldNumber: 5) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_TriangleListPrimitive, rhs: Foxglove_TriangleListPrimitive) -> Bool { - if lhs._pose != rhs._pose { return false } - if lhs.points != rhs.points { return false } - if lhs._color != rhs._color { return false } - if lhs.colors != rhs.colors { return false } - if lhs.indices != rhs.indices { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_TriangleListPrimitive, rhs: Foxglove_TriangleListPrimitive) -> Bool { + if lhs._pose != rhs._pose {return false} + if lhs.points != rhs.points {return false} + if lhs._color != rhs._color {return false} + if lhs.colors != rhs.colors {return false} + if lhs.indices != rhs.indices {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Vector2.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Vector2.pb.swift index 7e92e60..dd39c02 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Vector2.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Vector2.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -40,49 +40,47 @@ struct Foxglove_Vector2 { } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_Vector2: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_Vector2: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_Vector2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_Vector2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Vector2" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "x"), 2: .same(proto: "y"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularDoubleField(value: &x) - case 2: try decoder.decodeSingularDoubleField(value: &y) + case 1: try { try decoder.decodeSingularDoubleField(value: &self.x) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.y) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if x != 0 { - try visitor.visitSingularDoubleField(value: x, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if self.x != 0 { + try visitor.visitSingularDoubleField(value: self.x, fieldNumber: 1) } - if y != 0 { - try visitor.visitSingularDoubleField(value: y, fieldNumber: 2) + if self.y != 0 { + try visitor.visitSingularDoubleField(value: self.y, fieldNumber: 2) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_Vector2, rhs: Foxglove_Vector2) -> Bool { - if lhs.x != rhs.x { return false } - if lhs.y != rhs.y { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_Vector2, rhs: Foxglove_Vector2) -> Bool { + if lhs.x != rhs.x {return false} + if lhs.y != rhs.y {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } diff --git a/WebSocketDemo-Shared/Schemas/foxglove/Vector3.pb.swift b/WebSocketDemo-Shared/Schemas/foxglove/Vector3.pb.swift index ed58be6..488cc38 100644 --- a/WebSocketDemo-Shared/Schemas/foxglove/Vector3.pb.swift +++ b/WebSocketDemo-Shared/Schemas/foxglove/Vector3.pb.swift @@ -17,7 +17,7 @@ import SwiftProtobuf // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. -private struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } @@ -43,16 +43,14 @@ struct Foxglove_Vector3 { } #if swift(>=5.5) && canImport(_Concurrency) - extension Foxglove_Vector3: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +extension Foxglove_Vector3: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. -private let _protobuf_package = "foxglove" +fileprivate let _protobuf_package = "foxglove" -extension Foxglove_Vector3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, - SwiftProtobuf._ProtoNameProviding -{ +extension Foxglove_Vector3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".Vector3" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "x"), @@ -60,38 +58,38 @@ extension Foxglove_Vector3: SwiftProtobuf.Message, SwiftProtobuf._MessageImpleme 3: .same(proto: "z"), ] - mutating func decodeMessage(decoder: inout some SwiftProtobuf.Decoder) throws { + mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try decoder.decodeSingularDoubleField(value: &x) - case 2: try decoder.decodeSingularDoubleField(value: &y) - case 3: try decoder.decodeSingularDoubleField(value: &z) + case 1: try { try decoder.decodeSingularDoubleField(value: &self.x) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.y) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.z) }() default: break } } } - func traverse(visitor: inout some SwiftProtobuf.Visitor) throws { - if x != 0 { - try visitor.visitSingularDoubleField(value: x, fieldNumber: 1) + func traverse(visitor: inout V) throws { + if self.x != 0 { + try visitor.visitSingularDoubleField(value: self.x, fieldNumber: 1) } - if y != 0 { - try visitor.visitSingularDoubleField(value: y, fieldNumber: 2) + if self.y != 0 { + try visitor.visitSingularDoubleField(value: self.y, fieldNumber: 2) } - if z != 0 { - try visitor.visitSingularDoubleField(value: z, fieldNumber: 3) + if self.z != 0 { + try visitor.visitSingularDoubleField(value: self.z, fieldNumber: 3) } try unknownFields.traverse(visitor: &visitor) } - static func == (lhs: Foxglove_Vector3, rhs: Foxglove_Vector3) -> Bool { - if lhs.x != rhs.x { return false } - if lhs.y != rhs.y { return false } - if lhs.z != rhs.z { return false } - if lhs.unknownFields != rhs.unknownFields { return false } + static func ==(lhs: Foxglove_Vector3, rhs: Foxglove_Vector3) -> Bool { + if lhs.x != rhs.x {return false} + if lhs.y != rhs.y {return false} + if lhs.z != rhs.z {return false} + if lhs.unknownFields != rhs.unknownFields {return false} return true } } From a99f6b8e631efbdc9cadd079bb9e13b06dd5987b Mon Sep 17 00:00:00 2001 From: Jacob Bandes-Storch Date: Fri, 27 Oct 2023 16:21:32 -0500 Subject: [PATCH 3/7] disable code signing for CI build --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index e5a027b..c8f56cd 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,8 @@ build: -destination generic/platform=iOS \ -scheme "Foxglove Bridge" \ SYMROOT="$(PWD)"/build \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ -configuration Release \ clean build analyze From 1b602ecf975843841b4a576fe7fd9ebf2fe3e185 Mon Sep 17 00:00:00 2001 From: Jacob Bandes-Storch Date: Fri, 27 Oct 2023 16:33:14 -0500 Subject: [PATCH 4/7] fix for Xcode 14.2 on github actions runner --- .swiftformat | 2 +- Makefile | 2 +- WebSocketDemo-Shared/CameraManager.swift | 8 ++++---- WebSocketDemo-Shared/FoxgloveServer.swift | 7 ++++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.swiftformat b/.swiftformat index 064eb11..574859b 100644 --- a/.swiftformat +++ b/.swiftformat @@ -1,4 +1,4 @@ ---swiftversion 5.9 +--swiftversion 5.7 --indent 2 --maxwidth 120 --exclude WebSocketDemo-Shared/Schemas/foxglove diff --git a/Makefile b/Makefile index c8f56cd..303fbbe 100644 --- a/Makefile +++ b/Makefile @@ -21,4 +21,4 @@ lint-ci: .PHONY: format-ci format-ci: - docker run -t --rm -v "$(PWD)":/work ghcr.io/nicklockwood/swiftformat:0.52.8 --lint /work + docker run -t --rm -v "$(PWD)":/work ghcr.io/nicklockwood/swiftformat:0.52.8 /work diff --git a/WebSocketDemo-Shared/CameraManager.swift b/WebSocketDemo-Shared/CameraManager.swift index 46d1a3d..a26d1f7 100644 --- a/WebSocketDemo-Shared/CameraManager.swift +++ b/WebSocketDemo-Shared/CameraManager.swift @@ -37,13 +37,13 @@ private func configureInputs(in session: AVCaptureSession, for camera: Camera) t session.removeInput(input) } - let device: AVCaptureDevice? = switch camera { + let device: AVCaptureDevice? + switch camera { case .back: - .default(.builtInWideAngleCamera, for: .video, position: .back) + device = .default(.builtInWideAngleCamera, for: .video, position: .back) case .front: - .default(.builtInWideAngleCamera, for: .video, position: .front) + device = .default(.builtInWideAngleCamera, for: .video, position: .front) } - guard let device else { throw CameraError.noCameraDevice } diff --git a/WebSocketDemo-Shared/FoxgloveServer.swift b/WebSocketDemo-Shared/FoxgloveServer.swift index a7c2bea..c06d0f3 100644 --- a/WebSocketDemo-Shared/FoxgloveServer.swift +++ b/WebSocketDemo-Shared/FoxgloveServer.swift @@ -138,11 +138,12 @@ class FoxgloveServer: ObservableObject { self.sendInfo(connection) } - let closed: Bool = switch connection.state { + let closed: Bool + switch connection.state { case .cancelled, .failed: - true + closed = true default: - false + closed = false } Task { @MainActor in From d188d367c90fa8a799b0fe7dcf9ea8a7ae0ccb82 Mon Sep 17 00:00:00 2001 From: Jacob Bandes-Storch Date: Fri, 27 Oct 2023 16:40:35 -0500 Subject: [PATCH 5/7] fixes --- WebSocketDemo-Shared/Server.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/WebSocketDemo-Shared/Server.swift b/WebSocketDemo-Shared/Server.swift index 6251a85..b316831 100644 --- a/WebSocketDemo-Shared/Server.swift +++ b/WebSocketDemo-Shared/Server.swift @@ -284,7 +284,11 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe msg.width = UInt32(calibration.width) msg.height = UInt32(calibration.height) let data = try! msg.serializedData() - server.sendMessage(on: calibrationChannel, timestamp: DispatchTime.now().uptimeNanoseconds, payload: data) + self.server.sendMessage( + on: self.calibrationChannel, + timestamp: DispatchTime.now().uptimeNanoseconds, + payload: data + ) } .store(in: &subscribers) @@ -299,7 +303,7 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe msg.format = "jpeg" msg.data = $0 let data = try! msg.serializedData() - server.sendMessage(on: jpegChannel, timestamp: DispatchTime.now().uptimeNanoseconds, payload: data) + self.server.sendMessage(on: self.jpegChannel, timestamp: DispatchTime.now().uptimeNanoseconds, payload: data) } .store(in: &subscribers) @@ -314,7 +318,7 @@ class Server: NSObject, ObservableObject, AVCaptureVideoDataOutputSampleBufferDe msg.format = "h264" msg.data = $0 let data = try! msg.serializedData() - server.sendMessage(on: h264Channel, timestamp: DispatchTime.now().uptimeNanoseconds, payload: data) + self.server.sendMessage(on: self.h264Channel, timestamp: DispatchTime.now().uptimeNanoseconds, payload: data) } .store(in: &subscribers) From 0570b2b8d1aad6d62dad0d76b433cf84c38c00a3 Mon Sep 17 00:00:00 2001 From: Jacob Bandes-Storch Date: Fri, 27 Oct 2023 16:43:20 -0500 Subject: [PATCH 6/7] derping --- Makefile | 2 +- WebSocketDemo-Shared/CameraManager.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 303fbbe..c8f56cd 100644 --- a/Makefile +++ b/Makefile @@ -21,4 +21,4 @@ lint-ci: .PHONY: format-ci format-ci: - docker run -t --rm -v "$(PWD)":/work ghcr.io/nicklockwood/swiftformat:0.52.8 /work + docker run -t --rm -v "$(PWD)":/work ghcr.io/nicklockwood/swiftformat:0.52.8 --lint /work diff --git a/WebSocketDemo-Shared/CameraManager.swift b/WebSocketDemo-Shared/CameraManager.swift index a26d1f7..5af6d13 100644 --- a/WebSocketDemo-Shared/CameraManager.swift +++ b/WebSocketDemo-Shared/CameraManager.swift @@ -406,7 +406,7 @@ extension CMSampleBuffer { fromByteOffset: offset, as: UInt32.self ))) - resultBuffer[offset ..< offset + 4].copyBytes(from: startCode) + UnsafeMutableRawBufferPointer(rebasing: resultBuffer[offset ..< offset + 4]).copyBytes(from: startCode) offset += 4 + nalUnitLength } } From d4ffca45fc2418a1e02bf0358d962c41a59cf86b Mon Sep 17 00:00:00 2001 From: Jacob Bandes-Storch Date: Fri, 27 Oct 2023 17:06:35 -0500 Subject: [PATCH 7/7] more fixes --- WebSocketDemo-Shared/CameraManager.swift | 4 ++-- WebSocketDemo-Shared/FoxgloveServer.swift | 4 ++-- WebSocketDemo-Shared/IPAddressRow.swift | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/WebSocketDemo-Shared/CameraManager.swift b/WebSocketDemo-Shared/CameraManager.swift index 5af6d13..f6c9d2f 100644 --- a/WebSocketDemo-Shared/CameraManager.swift +++ b/WebSocketDemo-Shared/CameraManager.swift @@ -11,9 +11,9 @@ enum Camera: CaseIterable, Identifiable, CustomStringConvertible { var description: String { switch self { case .back: - "Back" + return "Back" case .front: - "Front" + return "Front" } } diff --git a/WebSocketDemo-Shared/FoxgloveServer.swift b/WebSocketDemo-Shared/FoxgloveServer.swift index c06d0f3..21f1b14 100644 --- a/WebSocketDemo-Shared/FoxgloveServer.swift +++ b/WebSocketDemo-Shared/FoxgloveServer.swift @@ -9,10 +9,10 @@ extension NWConnection: Hashable, Comparable, Identifiable { public static func < (lhs: NWConnection, rhs: NWConnection) -> Bool { switch (lhs.endpoint, rhs.endpoint) { case let (.hostPort(host1, _), .hostPort(host: host2, _)): - host1.debugDescription < host2.debugDescription + return host1.debugDescription < host2.debugDescription default: - ObjectIdentifier(lhs) < ObjectIdentifier(rhs) + return ObjectIdentifier(lhs) < ObjectIdentifier(rhs) } } diff --git a/WebSocketDemo-Shared/IPAddressRow.swift b/WebSocketDemo-Shared/IPAddressRow.swift index 552d692..ba37d23 100644 --- a/WebSocketDemo-Shared/IPAddressRow.swift +++ b/WebSocketDemo-Shared/IPAddressRow.swift @@ -24,17 +24,17 @@ struct IPAddressRow: View { var icon: Text { switch address.interface?.type { case .wifi?: - Text(Image(systemName: "wifi")) + return Text(Image(systemName: "wifi")) case .wiredEthernet?: - Text(Image(systemName: "cable.connector.horizontal")) + return Text(Image(systemName: "cable.connector.horizontal")) case .cellular?: - Text(Image(systemName: "antenna.radiowaves.left.and.right")) + return Text(Image(systemName: "antenna.radiowaves.left.and.right")) case .loopback?: - Text(Image(systemName: "arrow.counterclockwise")) + return Text(Image(systemName: "arrow.counterclockwise")) case .other?: - Text(Image(systemName: "questionmark")) + return Text(Image(systemName: "questionmark")) default: - Text("") + return Text("") } }