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;
29 namespace experimental {
32 } // namespace experimental
35 class CallOpSetInterface;
37 /// Straightforward wrapping of the C call object
41 : call_hook_(nullptr),
44 max_receive_message_size_(-1) {}
45 /** call is owned by the caller */
46 Call(grpc_call* call, CallHook* call_hook, ::grpc_impl::CompletionQueue* cq)
47 : call_hook_(call_hook),
50 max_receive_message_size_(-1) {}
52 Call(grpc_call* call, CallHook* call_hook, ::grpc_impl::CompletionQueue* cq,
53 experimental::ClientRpcInfo* rpc_info)
54 : call_hook_(call_hook),
57 max_receive_message_size_(-1),
58 client_rpc_info_(rpc_info) {}
60 Call(grpc_call* call, CallHook* call_hook, ::grpc_impl::CompletionQueue* cq,
61 int max_receive_message_size, experimental::ServerRpcInfo* rpc_info)
62 : call_hook_(call_hook),
65 max_receive_message_size_(max_receive_message_size),
66 server_rpc_info_(rpc_info) {}
68 void PerformOps(CallOpSetInterface* ops) {
69 call_hook_->PerformOpsOnCall(ops, this);
72 grpc_call* call() const { return call_; }
73 ::grpc_impl::CompletionQueue* cq() const { return cq_; }
75 int max_receive_message_size() const { return max_receive_message_size_; }
77 experimental::ClientRpcInfo* client_rpc_info() const {
78 return client_rpc_info_;
81 experimental::ServerRpcInfo* server_rpc_info() const {
82 return server_rpc_info_;
87 ::grpc_impl::CompletionQueue* cq_;
89 int max_receive_message_size_;
90 experimental::ClientRpcInfo* client_rpc_info_ = nullptr;
91 experimental::ServerRpcInfo* server_rpc_info_ = nullptr;
93 } // namespace internal
96 #endif // GRPCPP_IMPL_CODEGEN_CALL_H