1 // <auto-generated> 2 // Generated by the protocol buffer compiler. DO NOT EDIT! 3 // source: math/math.proto 4 // </auto-generated> 5 // Original file comments: 6 // Copyright 2015 gRPC authors. 7 // 8 // Licensed under the Apache License, Version 2.0 (the "License"); 9 // you may not use this file except in compliance with the License. 10 // You may obtain a copy of the License at 11 // 12 // http://www.apache.org/licenses/LICENSE-2.0 13 // 14 // Unless required by applicable law or agreed to in writing, software 15 // distributed under the License is distributed on an "AS IS" BASIS, 16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 // See the License for the specific language governing permissions and 18 // limitations under the License. 19 // 20 #pragma warning disable 0414, 1591 21 #region Designer generated code 22 23 using grpc = global::Grpc.Core; 24 25 namespace Math { 26 public static partial class Math 27 { 28 static readonly string __ServiceName = "math.Math"; 29 __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)30 static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context) 31 { 32 #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION 33 if (message is global::Google.Protobuf.IBufferMessage) 34 { 35 context.SetPayloadLength(message.CalculateSize()); 36 global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter()); 37 context.Complete(); 38 return; 39 } 40 #endif 41 context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message)); 42 } 43 44 static class __Helper_MessageCache<T> 45 { 46 public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T)); 47 } 48 49 static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T> 50 { 51 #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION 52 if (__Helper_MessageCache<T>.IsBufferMessage) 53 { 54 return parser.ParseFrom(context.PayloadAsReadOnlySequence()); 55 } 56 #endif 57 return parser.ParseFrom(context.PayloadAsNewBuffer()); 58 } 59 60 static readonly grpc::Marshaller<global::Math.DivArgs> __Marshaller_math_DivArgs = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Math.DivArgs.Parser)); 61 static readonly grpc::Marshaller<global::Math.DivReply> __Marshaller_math_DivReply = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Math.DivReply.Parser)); 62 static readonly grpc::Marshaller<global::Math.FibArgs> __Marshaller_math_FibArgs = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Math.FibArgs.Parser)); 63 static readonly grpc::Marshaller<global::Math.Num> __Marshaller_math_Num = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Math.Num.Parser)); 64 65 static readonly grpc::Method<global::Math.DivArgs, global::Math.DivReply> __Method_Div = new grpc::Method<global::Math.DivArgs, global::Math.DivReply>( 66 grpc::MethodType.Unary, 67 __ServiceName, 68 "Div", 69 __Marshaller_math_DivArgs, 70 __Marshaller_math_DivReply); 71 72 static readonly grpc::Method<global::Math.DivArgs, global::Math.DivReply> __Method_DivMany = new grpc::Method<global::Math.DivArgs, global::Math.DivReply>( 73 grpc::MethodType.DuplexStreaming, 74 __ServiceName, 75 "DivMany", 76 __Marshaller_math_DivArgs, 77 __Marshaller_math_DivReply); 78 79 static readonly grpc::Method<global::Math.FibArgs, global::Math.Num> __Method_Fib = new grpc::Method<global::Math.FibArgs, global::Math.Num>( 80 grpc::MethodType.ServerStreaming, 81 __ServiceName, 82 "Fib", 83 __Marshaller_math_FibArgs, 84 __Marshaller_math_Num); 85 86 static readonly grpc::Method<global::Math.Num, global::Math.Num> __Method_Sum = new grpc::Method<global::Math.Num, global::Math.Num>( 87 grpc::MethodType.ClientStreaming, 88 __ServiceName, 89 "Sum", 90 __Marshaller_math_Num, 91 __Marshaller_math_Num); 92 93 /// <summary>Service descriptor</summary> 94 public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor 95 { 96 get { return global::Math.MathReflection.Descriptor.Services[0]; } 97 } 98 99 /// <summary>Base class for server-side implementations of Math</summary> 100 [grpc::BindServiceMethod(typeof(Math), "BindService")] 101 public abstract partial class MathBase 102 { 103 /// <summary> 104 /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient 105 /// and remainder. 106 /// </summary> 107 /// <param name="request">The request received from the client.</param> 108 /// <param name="context">The context of the server-side call handler being invoked.</param> 109 /// <returns>The response to send back to the client (wrapped by a task).</returns> Div(global::Math.DivArgs request, grpc::ServerCallContext context)110 public virtual global::System.Threading.Tasks.Task<global::Math.DivReply> Div(global::Math.DivArgs request, grpc::ServerCallContext context) 111 { 112 throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); 113 } 114 115 /// <summary> 116 /// DivMany accepts an arbitrary number of division args from the client stream 117 /// and sends back the results in the reply stream. The stream continues until 118 /// the client closes its end; the server does the same after sending all the 119 /// replies. The stream ends immediately if either end aborts. 120 /// </summary> 121 /// <param name="requestStream">Used for reading requests from the client.</param> 122 /// <param name="responseStream">Used for sending responses back to the client.</param> 123 /// <param name="context">The context of the server-side call handler being invoked.</param> 124 /// <returns>A task indicating completion of the handler.</returns> DivMany(grpc::IAsyncStreamReader<global::Math.DivArgs> requestStream, grpc::IServerStreamWriter<global::Math.DivReply> responseStream, grpc::ServerCallContext context)125 public virtual global::System.Threading.Tasks.Task DivMany(grpc::IAsyncStreamReader<global::Math.DivArgs> requestStream, grpc::IServerStreamWriter<global::Math.DivReply> responseStream, grpc::ServerCallContext context) 126 { 127 throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); 128 } 129 130 /// <summary> 131 /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib 132 /// generates up to limit numbers; otherwise it continues until the call is 133 /// canceled. Unlike Fib above, Fib has no final FibReply. 134 /// </summary> 135 /// <param name="request">The request received from the client.</param> 136 /// <param name="responseStream">Used for sending responses back to the client.</param> 137 /// <param name="context">The context of the server-side call handler being invoked.</param> 138 /// <returns>A task indicating completion of the handler.</returns> Fib(global::Math.FibArgs request, grpc::IServerStreamWriter<global::Math.Num> responseStream, grpc::ServerCallContext context)139 public virtual global::System.Threading.Tasks.Task Fib(global::Math.FibArgs request, grpc::IServerStreamWriter<global::Math.Num> responseStream, grpc::ServerCallContext context) 140 { 141 throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); 142 } 143 144 /// <summary> 145 /// Sum sums a stream of numbers, returning the final result once the stream 146 /// is closed. 147 /// </summary> 148 /// <param name="requestStream">Used for reading requests from the client.</param> 149 /// <param name="context">The context of the server-side call handler being invoked.</param> 150 /// <returns>The response to send back to the client (wrapped by a task).</returns> Sum(grpc::IAsyncStreamReader<global::Math.Num> requestStream, grpc::ServerCallContext context)151 public virtual global::System.Threading.Tasks.Task<global::Math.Num> Sum(grpc::IAsyncStreamReader<global::Math.Num> requestStream, grpc::ServerCallContext context) 152 { 153 throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); 154 } 155 156 } 157 158 /// <summary>Client for Math</summary> 159 public partial class MathClient : grpc::ClientBase<MathClient> 160 { 161 /// <summary>Creates a new client for Math</summary> 162 /// <param name="channel">The channel to use to make remote calls.</param> MathClient(grpc::ChannelBase channel)163 public MathClient(grpc::ChannelBase channel) : base(channel) 164 { 165 } 166 /// <summary>Creates a new client for Math that uses a custom <c>CallInvoker</c>.</summary> 167 /// <param name="callInvoker">The callInvoker to use to make remote calls.</param> MathClient(grpc::CallInvoker callInvoker)168 public MathClient(grpc::CallInvoker callInvoker) : base(callInvoker) 169 { 170 } 171 /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary> MathClient()172 protected MathClient() : base() 173 { 174 } 175 /// <summary>Protected constructor to allow creation of configured clients.</summary> 176 /// <param name="configuration">The client configuration.</param> MathClient(ClientBaseConfiguration configuration)177 protected MathClient(ClientBaseConfiguration configuration) : base(configuration) 178 { 179 } 180 181 /// <summary> 182 /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient 183 /// and remainder. 184 /// </summary> 185 /// <param name="request">The request to send to the server.</param> 186 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param> 187 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param> 188 /// <param name="cancellationToken">An optional token for canceling the call.</param> 189 /// <returns>The response received from the server.</returns> Div(global::Math.DivArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))190 public virtual global::Math.DivReply Div(global::Math.DivArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 191 { 192 return Div(request, new grpc::CallOptions(headers, deadline, cancellationToken)); 193 } 194 /// <summary> 195 /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient 196 /// and remainder. 197 /// </summary> 198 /// <param name="request">The request to send to the server.</param> 199 /// <param name="options">The options for the call.</param> 200 /// <returns>The response received from the server.</returns> Div(global::Math.DivArgs request, grpc::CallOptions options)201 public virtual global::Math.DivReply Div(global::Math.DivArgs request, grpc::CallOptions options) 202 { 203 return CallInvoker.BlockingUnaryCall(__Method_Div, null, options, request); 204 } 205 /// <summary> 206 /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient 207 /// and remainder. 208 /// </summary> 209 /// <param name="request">The request to send to the server.</param> 210 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param> 211 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param> 212 /// <param name="cancellationToken">An optional token for canceling the call.</param> 213 /// <returns>The call object.</returns> DivAsync(global::Math.DivArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))214 public virtual grpc::AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 215 { 216 return DivAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); 217 } 218 /// <summary> 219 /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient 220 /// and remainder. 221 /// </summary> 222 /// <param name="request">The request to send to the server.</param> 223 /// <param name="options">The options for the call.</param> 224 /// <returns>The call object.</returns> DivAsync(global::Math.DivArgs request, grpc::CallOptions options)225 public virtual grpc::AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, grpc::CallOptions options) 226 { 227 return CallInvoker.AsyncUnaryCall(__Method_Div, null, options, request); 228 } 229 /// <summary> 230 /// DivMany accepts an arbitrary number of division args from the client stream 231 /// and sends back the results in the reply stream. The stream continues until 232 /// the client closes its end; the server does the same after sending all the 233 /// replies. The stream ends immediately if either end aborts. 234 /// </summary> 235 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param> 236 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param> 237 /// <param name="cancellationToken">An optional token for canceling the call.</param> 238 /// <returns>The call object.</returns> DivMany(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))239 public virtual grpc::AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 240 { 241 return DivMany(new grpc::CallOptions(headers, deadline, cancellationToken)); 242 } 243 /// <summary> 244 /// DivMany accepts an arbitrary number of division args from the client stream 245 /// and sends back the results in the reply stream. The stream continues until 246 /// the client closes its end; the server does the same after sending all the 247 /// replies. The stream ends immediately if either end aborts. 248 /// </summary> 249 /// <param name="options">The options for the call.</param> 250 /// <returns>The call object.</returns> DivMany(grpc::CallOptions options)251 public virtual grpc::AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(grpc::CallOptions options) 252 { 253 return CallInvoker.AsyncDuplexStreamingCall(__Method_DivMany, null, options); 254 } 255 /// <summary> 256 /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib 257 /// generates up to limit numbers; otherwise it continues until the call is 258 /// canceled. Unlike Fib above, Fib has no final FibReply. 259 /// </summary> 260 /// <param name="request">The request to send to the server.</param> 261 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param> 262 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param> 263 /// <param name="cancellationToken">An optional token for canceling the call.</param> 264 /// <returns>The call object.</returns> Fib(global::Math.FibArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))265 public virtual grpc::AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 266 { 267 return Fib(request, new grpc::CallOptions(headers, deadline, cancellationToken)); 268 } 269 /// <summary> 270 /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib 271 /// generates up to limit numbers; otherwise it continues until the call is 272 /// canceled. Unlike Fib above, Fib has no final FibReply. 273 /// </summary> 274 /// <param name="request">The request to send to the server.</param> 275 /// <param name="options">The options for the call.</param> 276 /// <returns>The call object.</returns> Fib(global::Math.FibArgs request, grpc::CallOptions options)277 public virtual grpc::AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, grpc::CallOptions options) 278 { 279 return CallInvoker.AsyncServerStreamingCall(__Method_Fib, null, options, request); 280 } 281 /// <summary> 282 /// Sum sums a stream of numbers, returning the final result once the stream 283 /// is closed. 284 /// </summary> 285 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param> 286 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param> 287 /// <param name="cancellationToken">An optional token for canceling the call.</param> 288 /// <returns>The call object.</returns> Sum(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))289 public virtual grpc::AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) 290 { 291 return Sum(new grpc::CallOptions(headers, deadline, cancellationToken)); 292 } 293 /// <summary> 294 /// Sum sums a stream of numbers, returning the final result once the stream 295 /// is closed. 296 /// </summary> 297 /// <param name="options">The options for the call.</param> 298 /// <returns>The call object.</returns> Sum(grpc::CallOptions options)299 public virtual grpc::AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(grpc::CallOptions options) 300 { 301 return CallInvoker.AsyncClientStreamingCall(__Method_Sum, null, options); 302 } 303 /// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary> NewInstance(ClientBaseConfiguration configuration)304 protected override MathClient NewInstance(ClientBaseConfiguration configuration) 305 { 306 return new MathClient(configuration); 307 } 308 } 309 310 /// <summary>Creates service definition that can be registered with a server</summary> 311 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> BindService(MathBase serviceImpl)312 public static grpc::ServerServiceDefinition BindService(MathBase serviceImpl) 313 { 314 return grpc::ServerServiceDefinition.CreateBuilder() 315 .AddMethod(__Method_Div, serviceImpl.Div) 316 .AddMethod(__Method_DivMany, serviceImpl.DivMany) 317 .AddMethod(__Method_Fib, serviceImpl.Fib) 318 .AddMethod(__Method_Sum, serviceImpl.Sum).Build(); 319 } 320 321 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. 322 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary> 323 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param> 324 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> BindService(grpc::ServiceBinderBase serviceBinder, MathBase serviceImpl)325 public static void BindService(grpc::ServiceBinderBase serviceBinder, MathBase serviceImpl) 326 { 327 serviceBinder.AddMethod(__Method_Div, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Math.DivArgs, global::Math.DivReply>(serviceImpl.Div)); 328 serviceBinder.AddMethod(__Method_DivMany, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod<global::Math.DivArgs, global::Math.DivReply>(serviceImpl.DivMany)); 329 serviceBinder.AddMethod(__Method_Fib, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod<global::Math.FibArgs, global::Math.Num>(serviceImpl.Fib)); 330 serviceBinder.AddMethod(__Method_Sum, serviceImpl == null ? null : new grpc::ClientStreamingServerMethod<global::Math.Num, global::Math.Num>(serviceImpl.Sum)); 331 } 332 333 } 334 } 335 #endregion 336