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