aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/ProtocolBuffers.Test/TestProtos/ServiceWithNoOuter.cs
blob: 8b5d97ee65f948678ad69179d29a69633c635c02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Generated by the protocol buffer compiler.  DO NOT EDIT!

using pb = global::Google.ProtocolBuffers;
using pbc = global::Google.ProtocolBuffers.Collections;
using pbd = global::Google.ProtocolBuffers.Descriptors;
using scg = global::System.Collections.Generic;
using self = global::Google.ProtocolBuffers.TestProtos;

namespace Google.ProtocolBuffers.TestProtos {
  
  public abstract class ServiceWithNoOuter : pb::IService {
    public abstract void Foo(
        pb::IRpcController controller,
        self::MessageWithNoOuter request,
        global::System.Action<self::TestAllTypes> done);
    
    public static pbd::ServiceDescriptor Descriptor {
      get { return self::MultiFileProto.Descriptor.Services[0]; }
    }
    public pbd::ServiceDescriptor DescriptorForType {
      get { return Descriptor; }
    }
    
    public void CallMethod(
        pbd::MethodDescriptor method,
        pb::IRpcController controller,
        pb::IMessage request,
        global::System.Action<pb::IMessage> done) {
      if (method.Service != Descriptor) {
        throw new global::System.ArgumentException(
          "Service.CallMethod() given method descriptor for wrong " +
          "service type.");
      }
      switch(method.Index) {
        case 0:
          this.Foo(controller, (self::MessageWithNoOuter)request,
            pb::RpcUtil.SpecializeCallback<self::TestAllTypes>(
              done));
          return;
        default:
          throw new global::System.InvalidOperationException("Can't get here.");
      }
    }
    
    public pb::IMessage GetRequestPrototype(pbd::MethodDescriptor method) {
      if (method.Service != Descriptor) {
        throw new global::System.ArgumentException(
          "Service.GetRequestPrototype() given method " +
          "descriptor for wrong service type.");
      }
      switch(method.Index) {
        case 0:
          return self::MessageWithNoOuter.DefaultInstance;
        default:
          throw new global::System.ArgumentException("Can't get here.");
      }
    }
    
    public pb::IMessage GetResponsePrototype(pbd::MethodDescriptor method) {
      if (method.Service != Descriptor) {
        throw new global::System.ArgumentException(
          "Service.GetResponsePrototype() given method " +
          "descriptor for wrong service type.");
      }
      switch(method.Index) {
        case 0:
          return self::TestAllTypes.DefaultInstance;
        default:
          throw new global::System.ArgumentException("Can't get here.");
      }
    }
    
    public static Stub CreateStub(
        pb::IRpcChannel channel) {
      return new Stub(channel);
    }
    
    public class Stub : self::ServiceWithNoOuter {
      internal Stub(pb::IRpcChannel channel) {
        this.channel = channel;
      }
      
      private readonly pb::IRpcChannel channel;
      
      public pb::IRpcChannel Channel {
        get { return channel; }
      }
      
      public override void Foo(
          pb::IRpcController controller,
          self::MessageWithNoOuter request,
          global::System.Action<self::TestAllTypes> done) {
        channel.CallMethod(
          Descriptor.Methods[0],
          controller,
          request,
          self::TestAllTypes.DefaultInstance,
          pb::RpcUtil.GeneralizeCallback<self::TestAllTypes, self::TestAllTypes.Builder>(done, self::TestAllTypes.DefaultInstance));
      }
    }
  }
  
}