GRPC C++  1.30.0
delegating_channel.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2019 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H
20 #define GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H
21 
22 namespace grpc {
23 namespace experimental {
24 
26  public:
27  virtual ~DelegatingChannel() {}
28 
29  DelegatingChannel(std::shared_ptr<::grpc::ChannelInterface> delegate_channel)
30  : delegate_channel_(delegate_channel) {}
31 
32  grpc_connectivity_state GetState(bool try_to_connect) override {
33  return delegate_channel()->GetState(try_to_connect);
34  }
35 
36  std::shared_ptr<::grpc::ChannelInterface> delegate_channel() {
37  return delegate_channel_;
38  }
39 
40  private:
41  internal::Call CreateCall(const internal::RpcMethod& method,
42  ClientContext* context,
43  ::grpc_impl::CompletionQueue* cq) final {
44  return delegate_channel()->CreateCall(method, context, cq);
45  }
46 
47  void PerformOpsOnCall(internal::CallOpSetInterface* ops,
48  internal::Call* call) final {
49  delegate_channel()->PerformOpsOnCall(ops, call);
50  }
51 
52  void* RegisterMethod(const char* method) final {
53  return delegate_channel()->RegisterMethod(method);
54  }
55 
56  void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
57  gpr_timespec deadline,
59  void* tag) override {
60  delegate_channel()->NotifyOnStateChangeImpl(last_observed, deadline, cq,
61  tag);
62  }
63 
64  bool WaitForStateChangeImpl(grpc_connectivity_state last_observed,
65  gpr_timespec deadline) override {
66  return delegate_channel()->WaitForStateChangeImpl(last_observed, deadline);
67  }
68 
69  internal::Call CreateCallInternal(const internal::RpcMethod& method,
70  ClientContext* context,
72  size_t interceptor_pos) final {
73  return delegate_channel()->CreateCallInternal(method, context, cq,
74  interceptor_pos);
75  }
76 
77  ::grpc_impl::CompletionQueue* CallbackCQ() final {
78  return delegate_channel()->CallbackCQ();
79  }
80 
81  std::shared_ptr<::grpc::ChannelInterface> delegate_channel_;
82 };
83 
84 } // namespace experimental
85 } // namespace grpc
86 
87 #endif // GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H
grpc::experimental::DelegatingChannel::GetState
grpc_connectivity_state GetState(bool try_to_connect) override
Get the current channel state.
Definition: delegating_channel.h:32
grpc
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
grpc::internal::Call
Straightforward wrapping of the C call object.
Definition: call.h:38
grpc::experimental::DelegatingChannel::delegate_channel
std::shared_ptr<::grpc::ChannelInterface > delegate_channel()
Definition: delegating_channel.h:36
grpc_connectivity_state
grpc_connectivity_state
Connectivity state of a channel.
Definition: connectivity_state.h:27
grpc::internal::CallOpSetInterface
An abstract collection of call ops, used to generate the grpc_call_op structure to pass down to the l...
Definition: call_op_set_interface.h:34
grpc::experimental::DelegatingChannel
Definition: delegating_channel.h:25
grpc::ChannelInterface
Codegen interface for grpc::Channel.
Definition: channel_interface.h:74
grpc::experimental::DelegatingChannel::DelegatingChannel
DelegatingChannel(std::shared_ptr<::grpc::ChannelInterface > delegate_channel)
Definition: delegating_channel.h:29
grpc_impl::CompletionQueue
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue_impl.h:103
grpc_impl::ClientContext
A ClientContext allows the person implementing a service client to:
Definition: client_context_impl.h:184
grpc::ClientContext
::grpc_impl::ClientContext ClientContext
Definition: client_context.h:26
grpc::internal::RpcMethod
Descriptor of an RPC method.
Definition: rpc_method.h:29
gpr_timespec
Analogous to struct timespec.
Definition: gpr_types.h:47
grpc::experimental::DelegatingChannel::~DelegatingChannel
virtual ~DelegatingChannel()
Definition: delegating_channel.h:27