From 0f5ee82cea9acdb44191353b4d37a689615ea483 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Sat, 30 May 2015 23:13:57 -0700 Subject: Move RouteGuideClient to generated_libraries/ --- .../Sample/RouteGuideClient/RouteGuide.pbobjc.h | 134 -------- .../Sample/RouteGuideClient/RouteGuide.pbobjc.m | 355 --------------------- .../Sample/RouteGuideClient/RouteGuide.pbrpc.h | 43 --- .../Sample/RouteGuideClient/RouteGuide.pbrpc.m | 72 ----- .../Sample/RouteGuideClient/Route_guide.podspec | 24 -- .../Sample/RouteGuideClient/route_guide.proto | 120 ------- .../RouteGuideClient/RouteGuide.pbobjc.h | 134 ++++++++ .../RouteGuideClient/RouteGuide.pbobjc.m | 355 +++++++++++++++++++++ .../RouteGuideClient/RouteGuide.pbrpc.h | 43 +++ .../RouteGuideClient/RouteGuide.pbrpc.m | 72 +++++ .../RouteGuideClient/Route_guide.podspec | 24 ++ .../RouteGuideClient/route_guide.proto | 120 +++++++ 12 files changed, 748 insertions(+), 748 deletions(-) delete mode 100644 src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbobjc.h delete mode 100644 src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbobjc.m delete mode 100644 src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbrpc.h delete mode 100644 src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbrpc.m delete mode 100644 src/objective-c/examples/Sample/RouteGuideClient/Route_guide.podspec delete mode 100644 src/objective-c/examples/Sample/RouteGuideClient/route_guide.proto create mode 100644 src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.h create mode 100644 src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.m create mode 100644 src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.h create mode 100644 src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.m create mode 100644 src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec create mode 100644 src/objective-c/generated_libraries/RouteGuideClient/route_guide.proto diff --git a/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbobjc.h b/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbobjc.h deleted file mode 100644 index 6efaec7f02..0000000000 --- a/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbobjc.h +++ /dev/null @@ -1,134 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: route_guide.proto - -#import "GPBProtocolBuffers.h" - -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000 -#error This file was generated by a different version of protoc-gen-objc which is incompatible with your Protocol Buffer sources. -#endif - -CF_EXTERN_C_BEGIN - -@class RGDFeature; -@class RGDPoint; -@class RGDRectangle; -@class RGDRouteNote; -@class RGDRouteSummary; - - -#pragma mark - RGDRouteGuideRoot - -@interface RGDRouteGuideRoot : GPBRootObject -@end - -#pragma mark - RGDPoint - -typedef GPB_ENUM(RGDPoint_FieldNumber) { - RGDPoint_FieldNumber_Latitude = 1, - RGDPoint_FieldNumber_Longitude = 2, -}; - -// Points are represented as latitude-longitude pairs in the E7 representation -// (degrees multiplied by 10**7 and rounded to the nearest integer). -// Latitudes should be in the range +/- 90 degrees and longitude should be in -// the range +/- 180 degrees (inclusive). -@interface RGDPoint : GPBMessage - -@property(nonatomic, readwrite) int32_t latitude; - -@property(nonatomic, readwrite) int32_t longitude; - -@end - -#pragma mark - RGDRectangle - -typedef GPB_ENUM(RGDRectangle_FieldNumber) { - RGDRectangle_FieldNumber_Lo = 1, - RGDRectangle_FieldNumber_Hi = 2, -}; - -// A latitude-longitude rectangle, represented as two diagonally opposite -// points "lo" and "hi". -@interface RGDRectangle : GPBMessage - -// One corner of the rectangle. -@property(nonatomic, readwrite) BOOL hasLo; -@property(nonatomic, readwrite, strong) RGDPoint *lo; - -// The other corner of the rectangle. -@property(nonatomic, readwrite) BOOL hasHi; -@property(nonatomic, readwrite, strong) RGDPoint *hi; - -@end - -#pragma mark - RGDFeature - -typedef GPB_ENUM(RGDFeature_FieldNumber) { - RGDFeature_FieldNumber_Name = 1, - RGDFeature_FieldNumber_Location = 2, -}; - -// A feature names something at a given point. -// -// If a feature could not be named, the name is empty. -@interface RGDFeature : GPBMessage - -// The name of the feature. -@property(nonatomic, readwrite, copy) NSString *name; - -// The point where the feature is detected. -@property(nonatomic, readwrite) BOOL hasLocation; -@property(nonatomic, readwrite, strong) RGDPoint *location; - -@end - -#pragma mark - RGDRouteNote - -typedef GPB_ENUM(RGDRouteNote_FieldNumber) { - RGDRouteNote_FieldNumber_Location = 1, - RGDRouteNote_FieldNumber_Message = 2, -}; - -// A RouteNote is a message sent while at a given point. -@interface RGDRouteNote : GPBMessage - -// The location from which the message is sent. -@property(nonatomic, readwrite) BOOL hasLocation; -@property(nonatomic, readwrite, strong) RGDPoint *location; - -// The message to be sent. -@property(nonatomic, readwrite, copy) NSString *message; - -@end - -#pragma mark - RGDRouteSummary - -typedef GPB_ENUM(RGDRouteSummary_FieldNumber) { - RGDRouteSummary_FieldNumber_PointCount = 1, - RGDRouteSummary_FieldNumber_FeatureCount = 2, - RGDRouteSummary_FieldNumber_Distance = 3, - RGDRouteSummary_FieldNumber_ElapsedTime = 4, -}; - -// A RouteSummary is received in response to a RecordRoute rpc. -// -// It contains the number of individual points received, the number of -// detected features, and the total distance covered as the cumulative sum of -// the distance between each point. -@interface RGDRouteSummary : GPBMessage - -// The number of points received. -@property(nonatomic, readwrite) int32_t pointCount; - -// The number of known features passed while traversing the route. -@property(nonatomic, readwrite) int32_t featureCount; - -// The distance covered in metres. -@property(nonatomic, readwrite) int32_t distance; - -// The duration of the traversal in seconds. -@property(nonatomic, readwrite) int32_t elapsedTime; - -@end - -CF_EXTERN_C_END diff --git a/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbobjc.m b/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbobjc.m deleted file mode 100644 index 16f291a61c..0000000000 --- a/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbobjc.m +++ /dev/null @@ -1,355 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: route_guide.proto - -#import "GPBProtocolBuffers_RuntimeSupport.h" - -#import "RouteGuide.pbobjc.h" - -#pragma mark - RGDRouteGuideRoot - -@implementation RGDRouteGuideRoot - -@end - -static GPBFileDescriptor *RGDRouteGuideRoot_FileDescriptor(void) { - // This is called by +initialize so there is no need to worry - // about thread safety of the singleton. - static GPBFileDescriptor *descriptor = NULL; - if (!descriptor) { - descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"grpc.example.routeguide" - syntax:GPBFileSyntaxProto3]; - } - return descriptor; -} - -#pragma mark - RGDPoint - -@implementation RGDPoint - -@dynamic latitude; -@dynamic longitude; - -typedef struct RGDPoint_Storage { - uint32_t _has_storage_[1]; - int32_t latitude; - int32_t longitude; -} RGDPoint_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "latitude", - .number = RGDPoint_FieldNumber_Latitude, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDPoint_Storage, latitude), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "longitude", - .number = RGDPoint_FieldNumber_Longitude, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDPoint_Storage, longitude), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RGDPoint class] - rootClass:[RGDRouteGuideRoot class] - file:RGDRouteGuideRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RGDPoint_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RGDRectangle - -@implementation RGDRectangle - -@dynamic hasLo, lo; -@dynamic hasHi, hi; - -typedef struct RGDRectangle_Storage { - uint32_t _has_storage_[1]; - RGDPoint *lo; - RGDPoint *hi; -} RGDRectangle_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "lo", - .number = RGDRectangle_FieldNumber_Lo, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RGDRectangle_Storage, lo), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RGDPoint), - .fieldOptions = NULL, - }, - { - .name = "hi", - .number = RGDRectangle_FieldNumber_Hi, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RGDRectangle_Storage, hi), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RGDPoint), - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRectangle class] - rootClass:[RGDRouteGuideRoot class] - file:RGDRouteGuideRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RGDRectangle_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RGDFeature - -@implementation RGDFeature - -@dynamic name; -@dynamic hasLocation, location; - -typedef struct RGDFeature_Storage { - uint32_t _has_storage_[1]; - NSString *name; - RGDPoint *location; -} RGDFeature_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "name", - .number = RGDFeature_FieldNumber_Name, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeString, - .offset = offsetof(RGDFeature_Storage, name), - .defaultValue.valueString = nil, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "location", - .number = RGDFeature_FieldNumber_Location, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RGDFeature_Storage, location), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RGDPoint), - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RGDFeature class] - rootClass:[RGDRouteGuideRoot class] - file:RGDRouteGuideRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RGDFeature_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RGDRouteNote - -@implementation RGDRouteNote - -@dynamic hasLocation, location; -@dynamic message; - -typedef struct RGDRouteNote_Storage { - uint32_t _has_storage_[1]; - RGDPoint *location; - NSString *message; -} RGDRouteNote_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "location", - .number = RGDRouteNote_FieldNumber_Location, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RGDRouteNote_Storage, location), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RGDPoint), - .fieldOptions = NULL, - }, - { - .name = "message", - .number = RGDRouteNote_FieldNumber_Message, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeString, - .offset = offsetof(RGDRouteNote_Storage, message), - .defaultValue.valueString = nil, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRouteNote class] - rootClass:[RGDRouteGuideRoot class] - file:RGDRouteGuideRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RGDRouteNote_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RGDRouteSummary - -@implementation RGDRouteSummary - -@dynamic pointCount; -@dynamic featureCount; -@dynamic distance; -@dynamic elapsedTime; - -typedef struct RGDRouteSummary_Storage { - uint32_t _has_storage_[1]; - int32_t pointCount; - int32_t featureCount; - int32_t distance; - int32_t elapsedTime; -} RGDRouteSummary_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "pointCount", - .number = RGDRouteSummary_FieldNumber_PointCount, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDRouteSummary_Storage, pointCount), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "featureCount", - .number = RGDRouteSummary_FieldNumber_FeatureCount, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDRouteSummary_Storage, featureCount), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "distance", - .number = RGDRouteSummary_FieldNumber_Distance, - .hasIndex = 2, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDRouteSummary_Storage, distance), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "elapsedTime", - .number = RGDRouteSummary_FieldNumber_ElapsedTime, - .hasIndex = 3, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDRouteSummary_Storage, elapsedTime), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRouteSummary class] - rootClass:[RGDRouteGuideRoot class] - file:RGDRouteGuideRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RGDRouteSummary_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - diff --git a/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbrpc.h b/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbrpc.h deleted file mode 100644 index 9e60865d98..0000000000 --- a/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbrpc.h +++ /dev/null @@ -1,43 +0,0 @@ -#import "RouteGuide.pbobjc.h" -#import - - -@protocol GRXWriteable; -@protocol GRXWriter; - -@protocol RGDRouteGuide - -#pragma mark GetFeature(Point) returns (Feature) - -- (void)getFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler; - -- (ProtoRPC *)RPCToGetFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler; - - -#pragma mark ListFeatures(Rectangle) returns (stream Feature) - -- (void)listFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler; - -- (ProtoRPC *)RPCToListFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler; - - -#pragma mark RecordRoute(stream Point) returns (RouteSummary) - -- (void)recordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler; - -- (ProtoRPC *)RPCToRecordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler; - - -#pragma mark RouteChat(stream RouteNote) returns (stream RouteNote) - -- (void)routeChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler; - -- (ProtoRPC *)RPCToRouteChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler; - - -@end - -// Basic service implementation, over gRPC, that only does marshalling and parsing. -@interface RGDRouteGuide : ProtoService -- (instancetype)initWithHost:(NSString *)host NS_DESIGNATED_INITIALIZER; -@end diff --git a/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbrpc.m b/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbrpc.m deleted file mode 100644 index 2ca3dc6768..0000000000 --- a/src/objective-c/examples/Sample/RouteGuideClient/RouteGuide.pbrpc.m +++ /dev/null @@ -1,72 +0,0 @@ -#import "RouteGuide.pbrpc.h" -#import -#import -#import - -static NSString *const kPackageName = @"grpc.example.routeguide"; -static NSString *const kServiceName = @"RouteGuide"; - -@implementation RGDRouteGuide - -// Designated initializer -- (instancetype)initWithHost:(NSString *)host { - return (self = [super initWithHost:host packageName:kPackageName serviceName:kServiceName]); -} - -// Override superclass initializer to disallow different package and service names. -- (instancetype)initWithHost:(NSString *)host - packageName:(NSString *)packageName - serviceName:(NSString *)serviceName { - return [self initWithHost:host]; -} - - -#pragma mark GetFeature(Point) returns (Feature) - -- (void)getFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler{ - [[self RPCToGetFeatureWithRequest:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToGetFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler{ - return [self RPCToMethod:@"GetFeature" - requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[RGDFeature class] - responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]]; -} -#pragma mark ListFeatures(Rectangle) returns (stream Feature) - -- (void)listFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler{ - [[self RPCToListFeaturesWithRequest:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToListFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler{ - return [self RPCToMethod:@"ListFeatures" - requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[RGDFeature class] - responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]]; -} -#pragma mark RecordRoute(stream Point) returns (RouteSummary) - -- (void)recordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler{ - [[self RPCToRecordRouteWithRequestsWriter:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToRecordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler{ - return [self RPCToMethod:@"RecordRoute" - requestsWriter:request - responseClass:[RGDRouteSummary class] - responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]]; -} -#pragma mark RouteChat(stream RouteNote) returns (stream RouteNote) - -- (void)routeChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler{ - [[self RPCToRouteChatWithRequestsWriter:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToRouteChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler{ - return [self RPCToMethod:@"RouteChat" - requestsWriter:request - responseClass:[RGDRouteNote class] - responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]]; -} -@end diff --git a/src/objective-c/examples/Sample/RouteGuideClient/Route_guide.podspec b/src/objective-c/examples/Sample/RouteGuideClient/Route_guide.podspec deleted file mode 100644 index 5b1a68aad5..0000000000 --- a/src/objective-c/examples/Sample/RouteGuideClient/Route_guide.podspec +++ /dev/null @@ -1,24 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'Route_guide' - s.version = '0.0.1' - s.summary = 'Protobuf library generated from route_guide.proto' - s.homepage = 'https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample/RouteGuideClient' - s.license = 'New BSD' - s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' } - - s.ios.deployment_target = '6.0' - s.osx.deployment_target = '10.8' - - s.subspec 'Messages' do |ms| - ms.source_files = '*.pbobjc.{h,m}' - ms.requires_arc = false - ms.dependency 'Protobuf', '~> 3.0' - end - - s.subspec 'Services' do |ss| - ss.source_files = '*.pbrpc.{h,m}' - ss.requires_arc = true - ss.dependency 'gRPC', '~> 0.0' - ss.dependency 'Route_guide/Messages' - end -end diff --git a/src/objective-c/examples/Sample/RouteGuideClient/route_guide.proto b/src/objective-c/examples/Sample/RouteGuideClient/route_guide.proto deleted file mode 100644 index 16dce26a2b..0000000000 --- a/src/objective-c/examples/Sample/RouteGuideClient/route_guide.proto +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package grpc.example.routeguide; - -option objc_class_prefix = "RGD"; - -// Interface exported by the server. -service RouteGuide { - // A simple RPC. - // - // Obtains the feature at a given position. - rpc GetFeature(Point) returns (Feature) {} - - // A server-to-client streaming RPC. - // - // Obtains the Features available within the given Rectangle. Results are - // streamed rather than returned at once (e.g. in a response message with a - // repeated field), as the rectangle may cover a large area and contain a - // huge number of features. - rpc ListFeatures(Rectangle) returns (stream Feature) {} - - // A client-to-server streaming RPC. - // - // Accepts a stream of Points on a route being traversed, returning a - // RouteSummary when traversal is completed. - rpc RecordRoute(stream Point) returns (RouteSummary) {} - - // A Bidirectional streaming RPC. - // - // Accepts a stream of RouteNotes sent while a route is being traversed, - // while receiving other RouteNotes (e.g. from other users). - rpc RouteChat(stream RouteNote) returns (stream RouteNote) {} -} - -// Points are represented as latitude-longitude pairs in the E7 representation -// (degrees multiplied by 10**7 and rounded to the nearest integer). -// Latitudes should be in the range +/- 90 degrees and longitude should be in -// the range +/- 180 degrees (inclusive). -message Point { - int32 latitude = 1; - int32 longitude = 2; -} - -// A latitude-longitude rectangle, represented as two diagonally opposite -// points "lo" and "hi". -message Rectangle { - // One corner of the rectangle. - Point lo = 1; - - // The other corner of the rectangle. - Point hi = 2; -} - -// A feature names something at a given point. -// -// If a feature could not be named, the name is empty. -message Feature { - // The name of the feature. - string name = 1; - - // The point where the feature is detected. - Point location = 2; -} - -// A RouteNote is a message sent while at a given point. -message RouteNote { - // The location from which the message is sent. - Point location = 1; - - // The message to be sent. - string message = 2; -} - -// A RouteSummary is received in response to a RecordRoute rpc. -// -// It contains the number of individual points received, the number of -// detected features, and the total distance covered as the cumulative sum of -// the distance between each point. -message RouteSummary { - // The number of points received. - int32 point_count = 1; - - // The number of known features passed while traversing the route. - int32 feature_count = 2; - - // The distance covered in metres. - int32 distance = 3; - - // The duration of the traversal in seconds. - int32 elapsed_time = 4; -} diff --git a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.h b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.h new file mode 100644 index 0000000000..6efaec7f02 --- /dev/null +++ b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.h @@ -0,0 +1,134 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: route_guide.proto + +#import "GPBProtocolBuffers.h" + +#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000 +#error This file was generated by a different version of protoc-gen-objc which is incompatible with your Protocol Buffer sources. +#endif + +CF_EXTERN_C_BEGIN + +@class RGDFeature; +@class RGDPoint; +@class RGDRectangle; +@class RGDRouteNote; +@class RGDRouteSummary; + + +#pragma mark - RGDRouteGuideRoot + +@interface RGDRouteGuideRoot : GPBRootObject +@end + +#pragma mark - RGDPoint + +typedef GPB_ENUM(RGDPoint_FieldNumber) { + RGDPoint_FieldNumber_Latitude = 1, + RGDPoint_FieldNumber_Longitude = 2, +}; + +// Points are represented as latitude-longitude pairs in the E7 representation +// (degrees multiplied by 10**7 and rounded to the nearest integer). +// Latitudes should be in the range +/- 90 degrees and longitude should be in +// the range +/- 180 degrees (inclusive). +@interface RGDPoint : GPBMessage + +@property(nonatomic, readwrite) int32_t latitude; + +@property(nonatomic, readwrite) int32_t longitude; + +@end + +#pragma mark - RGDRectangle + +typedef GPB_ENUM(RGDRectangle_FieldNumber) { + RGDRectangle_FieldNumber_Lo = 1, + RGDRectangle_FieldNumber_Hi = 2, +}; + +// A latitude-longitude rectangle, represented as two diagonally opposite +// points "lo" and "hi". +@interface RGDRectangle : GPBMessage + +// One corner of the rectangle. +@property(nonatomic, readwrite) BOOL hasLo; +@property(nonatomic, readwrite, strong) RGDPoint *lo; + +// The other corner of the rectangle. +@property(nonatomic, readwrite) BOOL hasHi; +@property(nonatomic, readwrite, strong) RGDPoint *hi; + +@end + +#pragma mark - RGDFeature + +typedef GPB_ENUM(RGDFeature_FieldNumber) { + RGDFeature_FieldNumber_Name = 1, + RGDFeature_FieldNumber_Location = 2, +}; + +// A feature names something at a given point. +// +// If a feature could not be named, the name is empty. +@interface RGDFeature : GPBMessage + +// The name of the feature. +@property(nonatomic, readwrite, copy) NSString *name; + +// The point where the feature is detected. +@property(nonatomic, readwrite) BOOL hasLocation; +@property(nonatomic, readwrite, strong) RGDPoint *location; + +@end + +#pragma mark - RGDRouteNote + +typedef GPB_ENUM(RGDRouteNote_FieldNumber) { + RGDRouteNote_FieldNumber_Location = 1, + RGDRouteNote_FieldNumber_Message = 2, +}; + +// A RouteNote is a message sent while at a given point. +@interface RGDRouteNote : GPBMessage + +// The location from which the message is sent. +@property(nonatomic, readwrite) BOOL hasLocation; +@property(nonatomic, readwrite, strong) RGDPoint *location; + +// The message to be sent. +@property(nonatomic, readwrite, copy) NSString *message; + +@end + +#pragma mark - RGDRouteSummary + +typedef GPB_ENUM(RGDRouteSummary_FieldNumber) { + RGDRouteSummary_FieldNumber_PointCount = 1, + RGDRouteSummary_FieldNumber_FeatureCount = 2, + RGDRouteSummary_FieldNumber_Distance = 3, + RGDRouteSummary_FieldNumber_ElapsedTime = 4, +}; + +// A RouteSummary is received in response to a RecordRoute rpc. +// +// It contains the number of individual points received, the number of +// detected features, and the total distance covered as the cumulative sum of +// the distance between each point. +@interface RGDRouteSummary : GPBMessage + +// The number of points received. +@property(nonatomic, readwrite) int32_t pointCount; + +// The number of known features passed while traversing the route. +@property(nonatomic, readwrite) int32_t featureCount; + +// The distance covered in metres. +@property(nonatomic, readwrite) int32_t distance; + +// The duration of the traversal in seconds. +@property(nonatomic, readwrite) int32_t elapsedTime; + +@end + +CF_EXTERN_C_END diff --git a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.m b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.m new file mode 100644 index 0000000000..16f291a61c --- /dev/null +++ b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.m @@ -0,0 +1,355 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: route_guide.proto + +#import "GPBProtocolBuffers_RuntimeSupport.h" + +#import "RouteGuide.pbobjc.h" + +#pragma mark - RGDRouteGuideRoot + +@implementation RGDRouteGuideRoot + +@end + +static GPBFileDescriptor *RGDRouteGuideRoot_FileDescriptor(void) { + // This is called by +initialize so there is no need to worry + // about thread safety of the singleton. + static GPBFileDescriptor *descriptor = NULL; + if (!descriptor) { + descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"grpc.example.routeguide" + syntax:GPBFileSyntaxProto3]; + } + return descriptor; +} + +#pragma mark - RGDPoint + +@implementation RGDPoint + +@dynamic latitude; +@dynamic longitude; + +typedef struct RGDPoint_Storage { + uint32_t _has_storage_[1]; + int32_t latitude; + int32_t longitude; +} RGDPoint_Storage; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = NULL; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "latitude", + .number = RGDPoint_FieldNumber_Latitude, + .hasIndex = 0, + .flags = GPBFieldOptional, + .type = GPBTypeInt32, + .offset = offsetof(RGDPoint_Storage, latitude), + .defaultValue.valueInt32 = 0, + .typeSpecific.className = NULL, + .fieldOptions = NULL, + }, + { + .name = "longitude", + .number = RGDPoint_FieldNumber_Longitude, + .hasIndex = 1, + .flags = GPBFieldOptional, + .type = GPBTypeInt32, + .offset = offsetof(RGDPoint_Storage, longitude), + .defaultValue.valueInt32 = 0, + .typeSpecific.className = NULL, + .fieldOptions = NULL, + }, + }; + descriptor = [GPBDescriptor allocDescriptorForClass:[RGDPoint class] + rootClass:[RGDRouteGuideRoot class] + file:RGDRouteGuideRoot_FileDescriptor() + fields:fields + fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) + oneofs:NULL + oneofCount:0 + enums:NULL + enumCount:0 + ranges:NULL + rangeCount:0 + storageSize:sizeof(RGDPoint_Storage) + wireFormat:NO]; + } + return descriptor; +} + +@end + +#pragma mark - RGDRectangle + +@implementation RGDRectangle + +@dynamic hasLo, lo; +@dynamic hasHi, hi; + +typedef struct RGDRectangle_Storage { + uint32_t _has_storage_[1]; + RGDPoint *lo; + RGDPoint *hi; +} RGDRectangle_Storage; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = NULL; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "lo", + .number = RGDRectangle_FieldNumber_Lo, + .hasIndex = 0, + .flags = GPBFieldOptional, + .type = GPBTypeMessage, + .offset = offsetof(RGDRectangle_Storage, lo), + .defaultValue.valueMessage = nil, + .typeSpecific.className = GPBStringifySymbol(RGDPoint), + .fieldOptions = NULL, + }, + { + .name = "hi", + .number = RGDRectangle_FieldNumber_Hi, + .hasIndex = 1, + .flags = GPBFieldOptional, + .type = GPBTypeMessage, + .offset = offsetof(RGDRectangle_Storage, hi), + .defaultValue.valueMessage = nil, + .typeSpecific.className = GPBStringifySymbol(RGDPoint), + .fieldOptions = NULL, + }, + }; + descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRectangle class] + rootClass:[RGDRouteGuideRoot class] + file:RGDRouteGuideRoot_FileDescriptor() + fields:fields + fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) + oneofs:NULL + oneofCount:0 + enums:NULL + enumCount:0 + ranges:NULL + rangeCount:0 + storageSize:sizeof(RGDRectangle_Storage) + wireFormat:NO]; + } + return descriptor; +} + +@end + +#pragma mark - RGDFeature + +@implementation RGDFeature + +@dynamic name; +@dynamic hasLocation, location; + +typedef struct RGDFeature_Storage { + uint32_t _has_storage_[1]; + NSString *name; + RGDPoint *location; +} RGDFeature_Storage; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = NULL; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "name", + .number = RGDFeature_FieldNumber_Name, + .hasIndex = 0, + .flags = GPBFieldOptional, + .type = GPBTypeString, + .offset = offsetof(RGDFeature_Storage, name), + .defaultValue.valueString = nil, + .typeSpecific.className = NULL, + .fieldOptions = NULL, + }, + { + .name = "location", + .number = RGDFeature_FieldNumber_Location, + .hasIndex = 1, + .flags = GPBFieldOptional, + .type = GPBTypeMessage, + .offset = offsetof(RGDFeature_Storage, location), + .defaultValue.valueMessage = nil, + .typeSpecific.className = GPBStringifySymbol(RGDPoint), + .fieldOptions = NULL, + }, + }; + descriptor = [GPBDescriptor allocDescriptorForClass:[RGDFeature class] + rootClass:[RGDRouteGuideRoot class] + file:RGDRouteGuideRoot_FileDescriptor() + fields:fields + fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) + oneofs:NULL + oneofCount:0 + enums:NULL + enumCount:0 + ranges:NULL + rangeCount:0 + storageSize:sizeof(RGDFeature_Storage) + wireFormat:NO]; + } + return descriptor; +} + +@end + +#pragma mark - RGDRouteNote + +@implementation RGDRouteNote + +@dynamic hasLocation, location; +@dynamic message; + +typedef struct RGDRouteNote_Storage { + uint32_t _has_storage_[1]; + RGDPoint *location; + NSString *message; +} RGDRouteNote_Storage; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = NULL; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "location", + .number = RGDRouteNote_FieldNumber_Location, + .hasIndex = 0, + .flags = GPBFieldOptional, + .type = GPBTypeMessage, + .offset = offsetof(RGDRouteNote_Storage, location), + .defaultValue.valueMessage = nil, + .typeSpecific.className = GPBStringifySymbol(RGDPoint), + .fieldOptions = NULL, + }, + { + .name = "message", + .number = RGDRouteNote_FieldNumber_Message, + .hasIndex = 1, + .flags = GPBFieldOptional, + .type = GPBTypeString, + .offset = offsetof(RGDRouteNote_Storage, message), + .defaultValue.valueString = nil, + .typeSpecific.className = NULL, + .fieldOptions = NULL, + }, + }; + descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRouteNote class] + rootClass:[RGDRouteGuideRoot class] + file:RGDRouteGuideRoot_FileDescriptor() + fields:fields + fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) + oneofs:NULL + oneofCount:0 + enums:NULL + enumCount:0 + ranges:NULL + rangeCount:0 + storageSize:sizeof(RGDRouteNote_Storage) + wireFormat:NO]; + } + return descriptor; +} + +@end + +#pragma mark - RGDRouteSummary + +@implementation RGDRouteSummary + +@dynamic pointCount; +@dynamic featureCount; +@dynamic distance; +@dynamic elapsedTime; + +typedef struct RGDRouteSummary_Storage { + uint32_t _has_storage_[1]; + int32_t pointCount; + int32_t featureCount; + int32_t distance; + int32_t elapsedTime; +} RGDRouteSummary_Storage; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = NULL; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "pointCount", + .number = RGDRouteSummary_FieldNumber_PointCount, + .hasIndex = 0, + .flags = GPBFieldOptional, + .type = GPBTypeInt32, + .offset = offsetof(RGDRouteSummary_Storage, pointCount), + .defaultValue.valueInt32 = 0, + .typeSpecific.className = NULL, + .fieldOptions = NULL, + }, + { + .name = "featureCount", + .number = RGDRouteSummary_FieldNumber_FeatureCount, + .hasIndex = 1, + .flags = GPBFieldOptional, + .type = GPBTypeInt32, + .offset = offsetof(RGDRouteSummary_Storage, featureCount), + .defaultValue.valueInt32 = 0, + .typeSpecific.className = NULL, + .fieldOptions = NULL, + }, + { + .name = "distance", + .number = RGDRouteSummary_FieldNumber_Distance, + .hasIndex = 2, + .flags = GPBFieldOptional, + .type = GPBTypeInt32, + .offset = offsetof(RGDRouteSummary_Storage, distance), + .defaultValue.valueInt32 = 0, + .typeSpecific.className = NULL, + .fieldOptions = NULL, + }, + { + .name = "elapsedTime", + .number = RGDRouteSummary_FieldNumber_ElapsedTime, + .hasIndex = 3, + .flags = GPBFieldOptional, + .type = GPBTypeInt32, + .offset = offsetof(RGDRouteSummary_Storage, elapsedTime), + .defaultValue.valueInt32 = 0, + .typeSpecific.className = NULL, + .fieldOptions = NULL, + }, + }; + descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRouteSummary class] + rootClass:[RGDRouteGuideRoot class] + file:RGDRouteGuideRoot_FileDescriptor() + fields:fields + fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) + oneofs:NULL + oneofCount:0 + enums:NULL + enumCount:0 + ranges:NULL + rangeCount:0 + storageSize:sizeof(RGDRouteSummary_Storage) + wireFormat:NO]; + } + return descriptor; +} + +@end + diff --git a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.h b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.h new file mode 100644 index 0000000000..9e60865d98 --- /dev/null +++ b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.h @@ -0,0 +1,43 @@ +#import "RouteGuide.pbobjc.h" +#import + + +@protocol GRXWriteable; +@protocol GRXWriter; + +@protocol RGDRouteGuide + +#pragma mark GetFeature(Point) returns (Feature) + +- (void)getFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler; + +- (ProtoRPC *)RPCToGetFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler; + + +#pragma mark ListFeatures(Rectangle) returns (stream Feature) + +- (void)listFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler; + +- (ProtoRPC *)RPCToListFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler; + + +#pragma mark RecordRoute(stream Point) returns (RouteSummary) + +- (void)recordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler; + +- (ProtoRPC *)RPCToRecordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler; + + +#pragma mark RouteChat(stream RouteNote) returns (stream RouteNote) + +- (void)routeChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler; + +- (ProtoRPC *)RPCToRouteChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler; + + +@end + +// Basic service implementation, over gRPC, that only does marshalling and parsing. +@interface RGDRouteGuide : ProtoService +- (instancetype)initWithHost:(NSString *)host NS_DESIGNATED_INITIALIZER; +@end diff --git a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.m b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.m new file mode 100644 index 0000000000..2ca3dc6768 --- /dev/null +++ b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.m @@ -0,0 +1,72 @@ +#import "RouteGuide.pbrpc.h" +#import +#import +#import + +static NSString *const kPackageName = @"grpc.example.routeguide"; +static NSString *const kServiceName = @"RouteGuide"; + +@implementation RGDRouteGuide + +// Designated initializer +- (instancetype)initWithHost:(NSString *)host { + return (self = [super initWithHost:host packageName:kPackageName serviceName:kServiceName]); +} + +// Override superclass initializer to disallow different package and service names. +- (instancetype)initWithHost:(NSString *)host + packageName:(NSString *)packageName + serviceName:(NSString *)serviceName { + return [self initWithHost:host]; +} + + +#pragma mark GetFeature(Point) returns (Feature) + +- (void)getFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler{ + [[self RPCToGetFeatureWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (ProtoRPC *)RPCToGetFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler{ + return [self RPCToMethod:@"GetFeature" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[RGDFeature class] + responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]]; +} +#pragma mark ListFeatures(Rectangle) returns (stream Feature) + +- (void)listFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler{ + [[self RPCToListFeaturesWithRequest:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (ProtoRPC *)RPCToListFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler{ + return [self RPCToMethod:@"ListFeatures" + requestsWriter:[GRXWriter writerWithValue:request] + responseClass:[RGDFeature class] + responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]]; +} +#pragma mark RecordRoute(stream Point) returns (RouteSummary) + +- (void)recordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler{ + [[self RPCToRecordRouteWithRequestsWriter:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (ProtoRPC *)RPCToRecordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler{ + return [self RPCToMethod:@"RecordRoute" + requestsWriter:request + responseClass:[RGDRouteSummary class] + responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]]; +} +#pragma mark RouteChat(stream RouteNote) returns (stream RouteNote) + +- (void)routeChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler{ + [[self RPCToRouteChatWithRequestsWriter:request handler:handler] start]; +} +// Returns a not-yet-started RPC object. +- (ProtoRPC *)RPCToRouteChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler{ + return [self RPCToMethod:@"RouteChat" + requestsWriter:request + responseClass:[RGDRouteNote class] + responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]]; +} +@end diff --git a/src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec b/src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec new file mode 100644 index 0000000000..5b1a68aad5 --- /dev/null +++ b/src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec @@ -0,0 +1,24 @@ +Pod::Spec.new do |s| + s.name = 'Route_guide' + s.version = '0.0.1' + s.summary = 'Protobuf library generated from route_guide.proto' + s.homepage = 'https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample/RouteGuideClient' + s.license = 'New BSD' + s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' } + + s.ios.deployment_target = '6.0' + s.osx.deployment_target = '10.8' + + s.subspec 'Messages' do |ms| + ms.source_files = '*.pbobjc.{h,m}' + ms.requires_arc = false + ms.dependency 'Protobuf', '~> 3.0' + end + + s.subspec 'Services' do |ss| + ss.source_files = '*.pbrpc.{h,m}' + ss.requires_arc = true + ss.dependency 'gRPC', '~> 0.0' + ss.dependency 'Route_guide/Messages' + end +end diff --git a/src/objective-c/generated_libraries/RouteGuideClient/route_guide.proto b/src/objective-c/generated_libraries/RouteGuideClient/route_guide.proto new file mode 100644 index 0000000000..16dce26a2b --- /dev/null +++ b/src/objective-c/generated_libraries/RouteGuideClient/route_guide.proto @@ -0,0 +1,120 @@ +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package grpc.example.routeguide; + +option objc_class_prefix = "RGD"; + +// Interface exported by the server. +service RouteGuide { + // A simple RPC. + // + // Obtains the feature at a given position. + rpc GetFeature(Point) returns (Feature) {} + + // A server-to-client streaming RPC. + // + // Obtains the Features available within the given Rectangle. Results are + // streamed rather than returned at once (e.g. in a response message with a + // repeated field), as the rectangle may cover a large area and contain a + // huge number of features. + rpc ListFeatures(Rectangle) returns (stream Feature) {} + + // A client-to-server streaming RPC. + // + // Accepts a stream of Points on a route being traversed, returning a + // RouteSummary when traversal is completed. + rpc RecordRoute(stream Point) returns (RouteSummary) {} + + // A Bidirectional streaming RPC. + // + // Accepts a stream of RouteNotes sent while a route is being traversed, + // while receiving other RouteNotes (e.g. from other users). + rpc RouteChat(stream RouteNote) returns (stream RouteNote) {} +} + +// Points are represented as latitude-longitude pairs in the E7 representation +// (degrees multiplied by 10**7 and rounded to the nearest integer). +// Latitudes should be in the range +/- 90 degrees and longitude should be in +// the range +/- 180 degrees (inclusive). +message Point { + int32 latitude = 1; + int32 longitude = 2; +} + +// A latitude-longitude rectangle, represented as two diagonally opposite +// points "lo" and "hi". +message Rectangle { + // One corner of the rectangle. + Point lo = 1; + + // The other corner of the rectangle. + Point hi = 2; +} + +// A feature names something at a given point. +// +// If a feature could not be named, the name is empty. +message Feature { + // The name of the feature. + string name = 1; + + // The point where the feature is detected. + Point location = 2; +} + +// A RouteNote is a message sent while at a given point. +message RouteNote { + // The location from which the message is sent. + Point location = 1; + + // The message to be sent. + string message = 2; +} + +// A RouteSummary is received in response to a RecordRoute rpc. +// +// It contains the number of individual points received, the number of +// detected features, and the total distance covered as the cumulative sum of +// the distance between each point. +message RouteSummary { + // The number of points received. + int32 point_count = 1; + + // The number of known features passed while traversing the route. + int32 feature_count = 2; + + // The distance covered in metres. + int32 distance = 3; + + // The duration of the traversal in seconds. + int32 elapsed_time = 4; +} -- cgit v1.2.3