ServiceWithNoOuter.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. using pb = global::Google.ProtocolBuffers;
  3. using pbc = global::Google.ProtocolBuffers.Collections;
  4. using pbd = global::Google.ProtocolBuffers.Descriptors;
  5. using scg = global::System.Collections.Generic;
  6. using self = global::Google.ProtocolBuffers.TestProtos;
  7. namespace Google.ProtocolBuffers.TestProtos {
  8. public abstract class ServiceWithNoOuter : pb::IService {
  9. public abstract void Foo(
  10. pb::IRpcController controller,
  11. self::MessageWithNoOuter request,
  12. global::System.Action<self::TestAllTypes> done);
  13. public static pbd::ServiceDescriptor Descriptor {
  14. get { return self::MultiFileProto.Descriptor.Services[0]; }
  15. }
  16. public pbd::ServiceDescriptor DescriptorForType {
  17. get { return Descriptor; }
  18. }
  19. public void CallMethod(
  20. pbd::MethodDescriptor method,
  21. pb::IRpcController controller,
  22. pb::IMessage request,
  23. global::System.Action<pb::IMessage> done) {
  24. if (method.Service != Descriptor) {
  25. throw new global::System.ArgumentException(
  26. "Service.CallMethod() given method descriptor for wrong " +
  27. "service type.");
  28. }
  29. switch(method.Index) {
  30. case 0:
  31. this.Foo(controller, (self::MessageWithNoOuter)request,
  32. pb::RpcUtil.SpecializeCallback<self::TestAllTypes>(
  33. done));
  34. return;
  35. default:
  36. throw new global::System.InvalidOperationException("Can't get here.");
  37. }
  38. }
  39. public pb::IMessage GetRequestPrototype(pbd::MethodDescriptor method) {
  40. if (method.Service != Descriptor) {
  41. throw new global::System.ArgumentException(
  42. "Service.GetRequestPrototype() given method " +
  43. "descriptor for wrong service type.");
  44. }
  45. switch(method.Index) {
  46. case 0:
  47. return self::MessageWithNoOuter.DefaultInstance;
  48. default:
  49. throw new global::System.ArgumentException("Can't get here.");
  50. }
  51. }
  52. public pb::IMessage GetResponsePrototype(pbd::MethodDescriptor method) {
  53. if (method.Service != Descriptor) {
  54. throw new global::System.ArgumentException(
  55. "Service.GetResponsePrototype() given method " +
  56. "descriptor for wrong service type.");
  57. }
  58. switch(method.Index) {
  59. case 0:
  60. return self::TestAllTypes.DefaultInstance;
  61. default:
  62. throw new global::System.ArgumentException("Can't get here.");
  63. }
  64. }
  65. public static Stub CreateStub(
  66. pb::IRpcChannel channel) {
  67. return new Stub(channel);
  68. }
  69. public class Stub : self::ServiceWithNoOuter {
  70. internal Stub(pb::IRpcChannel channel) {
  71. this.channel = channel;
  72. }
  73. private readonly pb::IRpcChannel channel;
  74. public pb::IRpcChannel Channel {
  75. get { return channel; }
  76. }
  77. public override void Foo(
  78. pb::IRpcController controller,
  79. self::MessageWithNoOuter request,
  80. global::System.Action<self::TestAllTypes> done) {
  81. channel.CallMethod(
  82. Descriptor.Methods[0],
  83. controller,
  84. request,
  85. self::TestAllTypes.DefaultInstance,
  86. pb::RpcUtil.GeneralizeCallback(done, self::TestAllTypes.DefaultInstance));
  87. }
  88. }
  89. }
  90. }