route_guide.pb.swift 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  138. fileprivate let _protobuf_package = "routeguide"
  139. extension Routeguide_Point: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  140. public static let protoMessageName: String = _protobuf_package + ".Point"
  141. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  142. 1: .same(proto: "latitude"),
  143. 2: .same(proto: "longitude"),
  144. ]
  145. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  146. while let fieldNumber = try decoder.nextFieldNumber() {
  147. // The use of inline closures is to circumvent an issue where the compiler
  148. // allocates stack space for every case branch when no optimizations are
  149. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  150. switch fieldNumber {
  151. case 1: try { try decoder.decodeSingularInt32Field(value: &self.latitude) }()
  152. case 2: try { try decoder.decodeSingularInt32Field(value: &self.longitude) }()
  153. default: break
  154. }
  155. }
  156. }
  157. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  158. if self.latitude != 0 {
  159. try visitor.visitSingularInt32Field(value: self.latitude, fieldNumber: 1)
  160. }
  161. if self.longitude != 0 {
  162. try visitor.visitSingularInt32Field(value: self.longitude, fieldNumber: 2)
  163. }
  164. try unknownFields.traverse(visitor: &visitor)
  165. }
  166. public static func ==(lhs: Routeguide_Point, rhs: Routeguide_Point) -> Bool {
  167. if lhs.latitude != rhs.latitude {return false}
  168. if lhs.longitude != rhs.longitude {return false}
  169. if lhs.unknownFields != rhs.unknownFields {return false}
  170. return true
  171. }
  172. }
  173. extension Routeguide_Rectangle: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  174. public static let protoMessageName: String = _protobuf_package + ".Rectangle"
  175. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  176. 1: .same(proto: "lo"),
  177. 2: .same(proto: "hi"),
  178. ]
  179. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  180. while let fieldNumber = try decoder.nextFieldNumber() {
  181. // The use of inline closures is to circumvent an issue where the compiler
  182. // allocates stack space for every case branch when no optimizations are
  183. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  184. switch fieldNumber {
  185. case 1: try { try decoder.decodeSingularMessageField(value: &self._lo) }()
  186. case 2: try { try decoder.decodeSingularMessageField(value: &self._hi) }()
  187. default: break
  188. }
  189. }
  190. }
  191. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  192. if let v = self._lo {
  193. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  194. }
  195. if let v = self._hi {
  196. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  197. }
  198. try unknownFields.traverse(visitor: &visitor)
  199. }
  200. public static func ==(lhs: Routeguide_Rectangle, rhs: Routeguide_Rectangle) -> Bool {
  201. if lhs._lo != rhs._lo {return false}
  202. if lhs._hi != rhs._hi {return false}
  203. if lhs.unknownFields != rhs.unknownFields {return false}
  204. return true
  205. }
  206. }
  207. extension Routeguide_Feature: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  208. public static let protoMessageName: String = _protobuf_package + ".Feature"
  209. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  210. 1: .same(proto: "name"),
  211. 2: .same(proto: "location"),
  212. ]
  213. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  214. while let fieldNumber = try decoder.nextFieldNumber() {
  215. // The use of inline closures is to circumvent an issue where the compiler
  216. // allocates stack space for every case branch when no optimizations are
  217. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  218. switch fieldNumber {
  219. case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
  220. case 2: try { try decoder.decodeSingularMessageField(value: &self._location) }()
  221. default: break
  222. }
  223. }
  224. }
  225. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  226. if !self.name.isEmpty {
  227. try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
  228. }
  229. if let v = self._location {
  230. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  231. }
  232. try unknownFields.traverse(visitor: &visitor)
  233. }
  234. public static func ==(lhs: Routeguide_Feature, rhs: Routeguide_Feature) -> Bool {
  235. if lhs.name != rhs.name {return false}
  236. if lhs._location != rhs._location {return false}
  237. if lhs.unknownFields != rhs.unknownFields {return false}
  238. return true
  239. }
  240. }
  241. extension Routeguide_RouteNote: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  242. public static let protoMessageName: String = _protobuf_package + ".RouteNote"
  243. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  244. 1: .same(proto: "location"),
  245. 2: .same(proto: "message"),
  246. ]
  247. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  248. while let fieldNumber = try decoder.nextFieldNumber() {
  249. // The use of inline closures is to circumvent an issue where the compiler
  250. // allocates stack space for every case branch when no optimizations are
  251. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  252. switch fieldNumber {
  253. case 1: try { try decoder.decodeSingularMessageField(value: &self._location) }()
  254. case 2: try { try decoder.decodeSingularStringField(value: &self.message) }()
  255. default: break
  256. }
  257. }
  258. }
  259. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  260. if let v = self._location {
  261. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  262. }
  263. if !self.message.isEmpty {
  264. try visitor.visitSingularStringField(value: self.message, fieldNumber: 2)
  265. }
  266. try unknownFields.traverse(visitor: &visitor)
  267. }
  268. public static func ==(lhs: Routeguide_RouteNote, rhs: Routeguide_RouteNote) -> Bool {
  269. if lhs._location != rhs._location {return false}
  270. if lhs.message != rhs.message {return false}
  271. if lhs.unknownFields != rhs.unknownFields {return false}
  272. return true
  273. }
  274. }
  275. extension Routeguide_RouteSummary: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  276. public static let protoMessageName: String = _protobuf_package + ".RouteSummary"
  277. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  278. 1: .standard(proto: "point_count"),
  279. 2: .standard(proto: "feature_count"),
  280. 3: .same(proto: "distance"),
  281. 4: .standard(proto: "elapsed_time"),
  282. ]
  283. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  284. while let fieldNumber = try decoder.nextFieldNumber() {
  285. // The use of inline closures is to circumvent an issue where the compiler
  286. // allocates stack space for every case branch when no optimizations are
  287. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  288. switch fieldNumber {
  289. case 1: try { try decoder.decodeSingularInt32Field(value: &self.pointCount) }()
  290. case 2: try { try decoder.decodeSingularInt32Field(value: &self.featureCount) }()
  291. case 3: try { try decoder.decodeSingularInt32Field(value: &self.distance) }()
  292. case 4: try { try decoder.decodeSingularInt32Field(value: &self.elapsedTime) }()
  293. default: break
  294. }
  295. }
  296. }
  297. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  298. if self.pointCount != 0 {
  299. try visitor.visitSingularInt32Field(value: self.pointCount, fieldNumber: 1)
  300. }
  301. if self.featureCount != 0 {
  302. try visitor.visitSingularInt32Field(value: self.featureCount, fieldNumber: 2)
  303. }
  304. if self.distance != 0 {
  305. try visitor.visitSingularInt32Field(value: self.distance, fieldNumber: 3)
  306. }
  307. if self.elapsedTime != 0 {
  308. try visitor.visitSingularInt32Field(value: self.elapsedTime, fieldNumber: 4)
  309. }
  310. try unknownFields.traverse(visitor: &visitor)
  311. }
  312. public static func ==(lhs: Routeguide_RouteSummary, rhs: Routeguide_RouteSummary) -> Bool {
  313. if lhs.pointCount != rhs.pointCount {return false}
  314. if lhs.featureCount != rhs.featureCount {return false}
  315. if lhs.distance != rhs.distance {return false}
  316. if lhs.elapsedTime != rhs.elapsedTime {return false}
  317. if lhs.unknownFields != rhs.unknownFields {return false}
  318. return true
  319. }
  320. }