3 * Copyright 2018 gRPC authors.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef GRPCPP_IMPL_CODEGEN_CALL_H
19 #define GRPCPP_IMPL_CODEGEN_CALL_H
21 #include <grpc/impl/codegen/grpc_types.h>
22 #include <grpcpp/impl/codegen/call_hook.h>
25 class CompletionQueue;
27 namespace experimental {
30 } // namespace experimental
33 class CallOpSetInterface;
35 /// Straightforward wrapping of the C call object
39 : call_hook_(nullptr),
42 max_receive_message_size_(-1) {}
43 /** call is owned by the caller */
44 Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq)
45 : call_hook_(call_hook),
48 max_receive_message_size_(-1) {}
50 Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq,
51 experimental::ClientRpcInfo* rpc_info)
52 : call_hook_(call_hook),
55 max_receive_message_size_(-1),
56 client_rpc_info_(rpc_info) {}
58 Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq,
59 int max_receive_message_size, experimental::ServerRpcInfo* rpc_info)
60 : call_hook_(call_hook),
63 max_receive_message_size_(max_receive_message_size),
64 server_rpc_info_(rpc_info) {}
66 void PerformOps(CallOpSetInterface* ops) {
67 call_hook_->PerformOpsOnCall(ops, this);
70 grpc_call* call() const { return call_; }
71 CompletionQueue* cq() const { return cq_; }
73 int max_receive_message_size() const { return max_receive_message_size_; }
75 experimental::ClientRpcInfo* client_rpc_info() const {
76 return client_rpc_info_;
79 experimental::ServerRpcInfo* server_rpc_info() const {
80 return server_rpc_info_;
87 int max_receive_message_size_;
88 experimental::ClientRpcInfo* client_rpc_info_ = nullptr;
89 experimental::ServerRpcInfo* server_rpc_info_ = nullptr;
91 } // namespace internal
94 #endif // GRPCPP_IMPL_CODEGEN_CALL_H