19 #ifndef GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
20 #define GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
40 template <
class InputMessage,
class OutputMessage,
41 class BaseInputMessage = InputMessage,
42 class BaseOutputMessage = OutputMessage>
45 const InputMessage& request, OutputMessage* result) {
46 static_assert(std::is_base_of<BaseInputMessage, InputMessage>::value,
47 "Invalid input message specification");
48 static_assert(std::is_base_of<BaseOutputMessage, OutputMessage>::value,
49 "Invalid output message specification");
51 channel, method, context, request, result)
55 template <
class InputMessage,
class OutputMessage>
60 const InputMessage& request, OutputMessage* result) {
69 status_ = ops.SendMessagePtr(&request);
73 ops.SendInitialMetadata(&context->send_initial_metadata_,
74 context->initial_metadata_flags());
75 ops.RecvInitialMetadata(context);
76 ops.RecvMessage(result);
78 ops.ClientSendClose();
79 ops.ClientRecvStatus(context, &status_);
80 call.PerformOps(&ops);
89 if (!ops.got_message && status_.
ok()) {
91 "No message returned for unary request");
Codegen interface for grpc::Channel.
Definition: channel_interface.h:71
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:193
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue.h:102
Did it work? If it didn't, why?
Definition: status.h:31
bool ok() const
Is the status OK?
Definition: status.h:118
Definition: client_unary_call.h:56
BlockingUnaryCallImpl(ChannelInterface *channel, const RpcMethod &method, grpc::ClientContext *context, const InputMessage &request, OutputMessage *result)
Definition: client_unary_call.h:58
Status status()
Definition: client_unary_call.h:94
Straightforward wrapping of the C call object.
Definition: call.h:35
Definition: call_op_set.h:769
Definition: call_op_set.h:619
Definition: call_op_set.h:424
Definition: call_op_set.h:282
Primary implementation of CallOpSetInterface.
Definition: call_op_set.h:867
Descriptor of an RPC method.
Definition: rpc_method.h:29
@ GRPC_CQ_PLUCK
Events are popped out by calling grpc_completion_queue_pluck() API ONLY.
Definition: grpc_types.h:747
#define GRPC_CQ_CURRENT_VERSION
Definition: grpc_types.h:776
@ GRPC_CQ_DEFAULT_POLLING
The completion queue will have an associated pollset and there is no restriction on the type of file ...
Definition: grpc_types.h:727
Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, grpc::ClientContext *context, const InputMessage &request, OutputMessage *result)
Wrapper that performs a blocking unary call.
Definition: client_unary_call.h:43
::google::protobuf::util::Status Status
Definition: config_protobuf.h:91
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
@ UNIMPLEMENTED
Operation is not implemented or not supported/enabled in this service.
Definition: status_code_enum.h:115
Definition: grpc_types.h:778