route_guide.pb.swift 16 KB

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