route_guide.pb.swift 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. // swiftlint:disable all
  4. //
  5. // Generated by the Swift generator plugin for the protocol buffer compiler.
  6. // Source: route_guide.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Copyright 2015 gRPC authors.
  11. //
  12. // Licensed under the Apache License, Version 2.0 (the "License");
  13. // you may not use this file except in compliance with the License.
  14. // You may obtain a copy of the License at
  15. //
  16. // http://www.apache.org/licenses/LICENSE-2.0
  17. //
  18. // Unless required by applicable law or agreed to in writing, software
  19. // distributed under the License is distributed on an "AS IS" BASIS,
  20. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. // See the License for the specific language governing permissions and
  22. // limitations under the License.
  23. import Foundation
  24. import SwiftProtobuf
  25. // If the compiler emits an error on this type, it is because this file
  26. // was generated by a version of the `protoc` Swift plug-in that is
  27. // incompatible with the version of SwiftProtobuf to which you are linking.
  28. // Please ensure that you are building against the same version of the API
  29. // that was used to generate this file.
  30. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  31. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  32. typealias Version = _2
  33. }
  34. /// Points are represented as latitude-longitude pairs in the E7 representation
  35. /// (degrees multiplied by 10**7 and rounded to the nearest integer).
  36. /// Latitudes should be in the range +/- 90 degrees and longitude should be in
  37. /// the range +/- 180 degrees (inclusive).
  38. public struct Routeguide_Point: Sendable {
  39. // SwiftProtobuf.Message conformance is added in an extension below. See the
  40. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  41. // methods supported on all messages.
  42. public var latitude: Int32 = 0
  43. public var longitude: Int32 = 0
  44. public var unknownFields = SwiftProtobuf.UnknownStorage()
  45. public init() {}
  46. }
  47. /// A latitude-longitude rectangle, represented as two diagonally opposite
  48. /// points "lo" and "hi".
  49. public struct Routeguide_Rectangle: Sendable {
  50. // SwiftProtobuf.Message conformance is added in an extension below. See the
  51. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  52. // methods supported on all messages.
  53. /// One corner of the rectangle.
  54. public var lo: Routeguide_Point {
  55. get {return _lo ?? Routeguide_Point()}
  56. set {_lo = newValue}
  57. }
  58. /// Returns true if `lo` has been explicitly set.
  59. public var hasLo: Bool {return self._lo != nil}
  60. /// Clears the value of `lo`. Subsequent reads from it will return its default value.
  61. public mutating func clearLo() {self._lo = nil}
  62. /// The other corner of the rectangle.
  63. public var hi: Routeguide_Point {
  64. get {return _hi ?? Routeguide_Point()}
  65. set {_hi = newValue}
  66. }
  67. /// Returns true if `hi` has been explicitly set.
  68. public var hasHi: Bool {return self._hi != nil}
  69. /// Clears the value of `hi`. Subsequent reads from it will return its default value.
  70. public mutating func clearHi() {self._hi = nil}
  71. public var unknownFields = SwiftProtobuf.UnknownStorage()
  72. public init() {}
  73. fileprivate var _lo: Routeguide_Point? = nil
  74. fileprivate var _hi: Routeguide_Point? = nil
  75. }
  76. /// A feature names something at a given point.
  77. ///
  78. /// If a feature could not be named, the name is empty.
  79. public struct Routeguide_Feature: Sendable {
  80. // SwiftProtobuf.Message conformance is added in an extension below. See the
  81. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  82. // methods supported on all messages.
  83. /// The name of the feature.
  84. public var name: String = String()
  85. /// The point where the feature is detected.
  86. public var location: Routeguide_Point {
  87. get {return _location ?? Routeguide_Point()}
  88. set {_location = newValue}
  89. }
  90. /// Returns true if `location` has been explicitly set.
  91. public var hasLocation: Bool {return self._location != nil}
  92. /// Clears the value of `location`. Subsequent reads from it will return its default value.
  93. public mutating func clearLocation() {self._location = nil}
  94. public var unknownFields = SwiftProtobuf.UnknownStorage()
  95. public init() {}
  96. fileprivate var _location: Routeguide_Point? = nil
  97. }
  98. /// A RouteNote is a message sent while at a given point.
  99. public struct Routeguide_RouteNote: Sendable {
  100. // SwiftProtobuf.Message conformance is added in an extension below. See the
  101. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  102. // methods supported on all messages.
  103. /// The location from which the message is sent.
  104. public var location: Routeguide_Point {
  105. get {return _location ?? Routeguide_Point()}
  106. set {_location = newValue}
  107. }
  108. /// Returns true if `location` has been explicitly set.
  109. public var hasLocation: Bool {return self._location != nil}
  110. /// Clears the value of `location`. Subsequent reads from it will return its default value.
  111. public mutating func clearLocation() {self._location = nil}
  112. /// The message to be sent.
  113. public var message: String = String()
  114. public var unknownFields = SwiftProtobuf.UnknownStorage()
  115. public init() {}
  116. fileprivate var _location: Routeguide_Point? = nil
  117. }
  118. /// A RouteSummary is received in response to a RecordRoute rpc.
  119. ///
  120. /// It contains the number of individual points received, the number of
  121. /// detected features, and the total distance covered as the cumulative sum of
  122. /// the distance between each point.
  123. public struct Routeguide_RouteSummary: Sendable {
  124. // SwiftProtobuf.Message conformance is added in an extension below. See the
  125. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  126. // methods supported on all messages.
  127. /// The number of points received.
  128. public var pointCount: Int32 = 0
  129. /// The number of known features passed while traversing the route.
  130. public var featureCount: Int32 = 0
  131. /// The distance covered in metres.
  132. public var distance: Int32 = 0
  133. /// The duration of the traversal in seconds.
  134. public var elapsedTime: Int32 = 0
  135. public var unknownFields = SwiftProtobuf.UnknownStorage()
  136. public init() {}
  137. }
  138. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  139. fileprivate let _protobuf_package = "routeguide"
  140. extension Routeguide_Point: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  141. public static let protoMessageName: String = _protobuf_package + ".Point"
  142. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  143. 1: .same(proto: "latitude"),
  144. 2: .same(proto: "longitude"),
  145. ]
  146. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  147. while let fieldNumber = try decoder.nextFieldNumber() {
  148. // The use of inline closures is to circumvent an issue where the compiler
  149. // allocates stack space for every case branch when no optimizations are
  150. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  151. switch fieldNumber {
  152. case 1: try { try decoder.decodeSingularInt32Field(value: &self.latitude) }()
  153. case 2: try { try decoder.decodeSingularInt32Field(value: &self.longitude) }()
  154. default: break
  155. }
  156. }
  157. }
  158. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  159. if self.latitude != 0 {
  160. try visitor.visitSingularInt32Field(value: self.latitude, fieldNumber: 1)
  161. }
  162. if self.longitude != 0 {
  163. try visitor.visitSingularInt32Field(value: self.longitude, fieldNumber: 2)
  164. }
  165. try unknownFields.traverse(visitor: &visitor)
  166. }
  167. public static func ==(lhs: Routeguide_Point, rhs: Routeguide_Point) -> Bool {
  168. if lhs.latitude != rhs.latitude {return false}
  169. if lhs.longitude != rhs.longitude {return false}
  170. if lhs.unknownFields != rhs.unknownFields {return false}
  171. return true
  172. }
  173. }
  174. extension Routeguide_Rectangle: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  175. public static let protoMessageName: String = _protobuf_package + ".Rectangle"
  176. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  177. 1: .same(proto: "lo"),
  178. 2: .same(proto: "hi"),
  179. ]
  180. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  181. while let fieldNumber = try decoder.nextFieldNumber() {
  182. // The use of inline closures is to circumvent an issue where the compiler
  183. // allocates stack space for every case branch when no optimizations are
  184. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  185. switch fieldNumber {
  186. case 1: try { try decoder.decodeSingularMessageField(value: &self._lo) }()
  187. case 2: try { try decoder.decodeSingularMessageField(value: &self._hi) }()
  188. default: break
  189. }
  190. }
  191. }
  192. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  193. // The use of inline closures is to circumvent an issue where the compiler
  194. // allocates stack space for every if/case branch local when no optimizations
  195. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  196. // https://github.com/apple/swift-protobuf/issues/1182
  197. try { if let v = self._lo {
  198. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  199. } }()
  200. try { if let v = self._hi {
  201. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  202. } }()
  203. try unknownFields.traverse(visitor: &visitor)
  204. }
  205. public static func ==(lhs: Routeguide_Rectangle, rhs: Routeguide_Rectangle) -> Bool {
  206. if lhs._lo != rhs._lo {return false}
  207. if lhs._hi != rhs._hi {return false}
  208. if lhs.unknownFields != rhs.unknownFields {return false}
  209. return true
  210. }
  211. }
  212. extension Routeguide_Feature: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  213. public static let protoMessageName: String = _protobuf_package + ".Feature"
  214. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  215. 1: .same(proto: "name"),
  216. 2: .same(proto: "location"),
  217. ]
  218. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  219. while let fieldNumber = try decoder.nextFieldNumber() {
  220. // The use of inline closures is to circumvent an issue where the compiler
  221. // allocates stack space for every case branch when no optimizations are
  222. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  223. switch fieldNumber {
  224. case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
  225. case 2: try { try decoder.decodeSingularMessageField(value: &self._location) }()
  226. default: break
  227. }
  228. }
  229. }
  230. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  231. // The use of inline closures is to circumvent an issue where the compiler
  232. // allocates stack space for every if/case branch local when no optimizations
  233. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  234. // https://github.com/apple/swift-protobuf/issues/1182
  235. if !self.name.isEmpty {
  236. try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
  237. }
  238. try { if let v = self._location {
  239. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  240. } }()
  241. try unknownFields.traverse(visitor: &visitor)
  242. }
  243. public static func ==(lhs: Routeguide_Feature, rhs: Routeguide_Feature) -> Bool {
  244. if lhs.name != rhs.name {return false}
  245. if lhs._location != rhs._location {return false}
  246. if lhs.unknownFields != rhs.unknownFields {return false}
  247. return true
  248. }
  249. }
  250. extension Routeguide_RouteNote: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  251. public static let protoMessageName: String = _protobuf_package + ".RouteNote"
  252. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  253. 1: .same(proto: "location"),
  254. 2: .same(proto: "message"),
  255. ]
  256. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  257. while let fieldNumber = try decoder.nextFieldNumber() {
  258. // The use of inline closures is to circumvent an issue where the compiler
  259. // allocates stack space for every case branch when no optimizations are
  260. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  261. switch fieldNumber {
  262. case 1: try { try decoder.decodeSingularMessageField(value: &self._location) }()
  263. case 2: try { try decoder.decodeSingularStringField(value: &self.message) }()
  264. default: break
  265. }
  266. }
  267. }
  268. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  269. // The use of inline closures is to circumvent an issue where the compiler
  270. // allocates stack space for every if/case branch local when no optimizations
  271. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  272. // https://github.com/apple/swift-protobuf/issues/1182
  273. try { if let v = self._location {
  274. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  275. } }()
  276. if !self.message.isEmpty {
  277. try visitor.visitSingularStringField(value: self.message, fieldNumber: 2)
  278. }
  279. try unknownFields.traverse(visitor: &visitor)
  280. }
  281. public static func ==(lhs: Routeguide_RouteNote, rhs: Routeguide_RouteNote) -> Bool {
  282. if lhs._location != rhs._location {return false}
  283. if lhs.message != rhs.message {return false}
  284. if lhs.unknownFields != rhs.unknownFields {return false}
  285. return true
  286. }
  287. }
  288. extension Routeguide_RouteSummary: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  289. public static let protoMessageName: String = _protobuf_package + ".RouteSummary"
  290. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  291. 1: .standard(proto: "point_count"),
  292. 2: .standard(proto: "feature_count"),
  293. 3: .same(proto: "distance"),
  294. 4: .standard(proto: "elapsed_time"),
  295. ]
  296. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  297. while let fieldNumber = try decoder.nextFieldNumber() {
  298. // The use of inline closures is to circumvent an issue where the compiler
  299. // allocates stack space for every case branch when no optimizations are
  300. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  301. switch fieldNumber {
  302. case 1: try { try decoder.decodeSingularInt32Field(value: &self.pointCount) }()
  303. case 2: try { try decoder.decodeSingularInt32Field(value: &self.featureCount) }()
  304. case 3: try { try decoder.decodeSingularInt32Field(value: &self.distance) }()
  305. case 4: try { try decoder.decodeSingularInt32Field(value: &self.elapsedTime) }()
  306. default: break
  307. }
  308. }
  309. }
  310. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  311. if self.pointCount != 0 {
  312. try visitor.visitSingularInt32Field(value: self.pointCount, fieldNumber: 1)
  313. }
  314. if self.featureCount != 0 {
  315. try visitor.visitSingularInt32Field(value: self.featureCount, fieldNumber: 2)
  316. }
  317. if self.distance != 0 {
  318. try visitor.visitSingularInt32Field(value: self.distance, fieldNumber: 3)
  319. }
  320. if self.elapsedTime != 0 {
  321. try visitor.visitSingularInt32Field(value: self.elapsedTime, fieldNumber: 4)
  322. }
  323. try unknownFields.traverse(visitor: &visitor)
  324. }
  325. public static func ==(lhs: Routeguide_RouteSummary, rhs: Routeguide_RouteSummary) -> Bool {
  326. if lhs.pointCount != rhs.pointCount {return false}
  327. if lhs.featureCount != rhs.featureCount {return false}
  328. if lhs.distance != rhs.distance {return false}
  329. if lhs.elapsedTime != rhs.elapsedTime {return false}
  330. if lhs.unknownFields != rhs.unknownFields {return false}
  331. return true
  332. }
  333. }