GRPC C++  1.53.0
call.h
Go to the documentation of this file.
1 //
2 //
3 // Copyright 2015 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_CALL_H
20 #define GRPCPP_IMPL_CALL_H
21 
22 #include <grpc/impl/grpc_types.h>
23 #include <grpcpp/impl/call_hook.h>
24 
25 namespace grpc {
26 class CompletionQueue;
27 namespace experimental {
28 class ClientRpcInfo;
29 class ServerRpcInfo;
30 } // namespace experimental
31 namespace internal {
32 class CallHook;
33 class CallOpSetInterface;
34 
36 class Call final {
37  public:
38  Call()
39  : call_hook_(nullptr),
40  cq_(nullptr),
41  call_(nullptr),
42  max_receive_message_size_(-1) {}
45  : call_hook_(call_hook),
46  cq_(cq),
47  call_(call),
48  max_receive_message_size_(-1) {}
49 
52  : call_hook_(call_hook),
53  cq_(cq),
54  call_(call),
55  max_receive_message_size_(-1),
56  client_rpc_info_(rpc_info) {}
57 
60  : call_hook_(call_hook),
61  cq_(cq),
62  call_(call),
63  max_receive_message_size_(max_receive_message_size),
64  server_rpc_info_(rpc_info) {}
65 
67  call_hook_->PerformOpsOnCall(ops, this);
68  }
69 
70  grpc_call* call() const { return call_; }
71  grpc::CompletionQueue* cq() const { return cq_; }
72 
73  int max_receive_message_size() const { return max_receive_message_size_; }
74 
76  return client_rpc_info_;
77  }
78 
80  return server_rpc_info_;
81  }
82 
83  private:
84  CallHook* call_hook_;
86  grpc_call* call_;
87  int max_receive_message_size_;
88  experimental::ClientRpcInfo* client_rpc_info_ = nullptr;
89  experimental::ServerRpcInfo* server_rpc_info_ = nullptr;
90 };
91 } // namespace internal
92 } // namespace grpc
93 
94 #endif // GRPCPP_IMPL_CALL_H
grpc::internal::Call::cq
grpc::CompletionQueue * cq() const
Definition: call.h:71
grpc::internal::Call::max_receive_message_size
int max_receive_message_size() const
Definition: call.h:73
grpc
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:32
grpc::internal::Call::Call
Call(grpc_call *call, CallHook *call_hook, grpc::CompletionQueue *cq, int max_receive_message_size, experimental::ServerRpcInfo *rpc_info)
Definition: call.h:58
grpc::internal::CallHook
This is an interface that Channel and Server implement to allow them to hook performing ops.
Definition: call_hook.h:30
grpc::internal::Call
Straightforward wrapping of the C call object.
Definition: call.h:36
grpc_types.h
grpc::internal::Call::Call
Call()
Definition: call.h:38
grpc::experimental::ClientRpcInfo
Definition: client_interceptor.h:67
grpc::internal::Call::Call
Call(grpc_call *call, CallHook *call_hook, grpc::CompletionQueue *cq)
call is owned by the caller
Definition: call.h:44
grpc_call
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:69
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:36
call_hook.h
grpc::experimental::ServerRpcInfo
ServerRpcInfo represents the state of a particular RPC as it appears to an interceptor.
Definition: server_interceptor.h:57
grpc::internal::Call::server_rpc_info
experimental::ServerRpcInfo * server_rpc_info() const
Definition: call.h:79
grpc::internal::CallHook::PerformOpsOnCall
virtual void PerformOpsOnCall(CallOpSetInterface *ops, Call *call)=0
grpc::internal::Call::PerformOps
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:66
grpc::internal::Call::call
grpc_call * call() const
Definition: call.h:70
grpc::CompletionQueue
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue.h:103
grpc::internal::Call::Call
Call(grpc_call *call, CallHook *call_hook, grpc::CompletionQueue *cq, experimental::ClientRpcInfo *rpc_info)
Definition: call.h:50
grpc::internal::Call::client_rpc_info
experimental::ClientRpcInfo * client_rpc_info() const
Definition: call.h:75