Go to the documentation of this file.
19 #ifndef GRPCPP_IMPL_CLIENT_UNARY_CALL_H
20 #define GRPCPP_IMPL_CLIENT_UNARY_CALL_H
39 template <
class InputMessage,
class OutputMessage,
40 class BaseInputMessage = InputMessage,
41 class BaseOutputMessage = OutputMessage>
44 const InputMessage& request, OutputMessage* result) {
45 static_assert(std::is_base_of<BaseInputMessage, InputMessage>::value,
46 "Invalid input message specification");
47 static_assert(std::is_base_of<BaseOutputMessage, OutputMessage>::value,
48 "Invalid output message specification");
50 channel, method, context, request, result)
54 template <
class InputMessage,
class OutputMessage>
55 class BlockingUnaryCallImpl {
59 const InputMessage& request, OutputMessage* result) {
68 status_ = ops.SendMessagePtr(&request);
72 ops.SendInitialMetadata(&context->send_initial_metadata_,
73 context->initial_metadata_flags());
74 ops.RecvInitialMetadata(context);
75 ops.RecvMessage(result);
77 ops.ClientSendClose();
78 ops.ClientRecvStatus(context, &status_);
79 call.PerformOps(&ops);
88 if (!ops.got_message && status_.
ok()) {
90 "No message returned for unary request");
102 #endif // GRPCPP_IMPL_CLIENT_UNARY_CALL_H
Definition: call_op_set.h:621
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
Primary implementation of CallOpSetInterface.
Definition: completion_queue.h:98
Definition: call_op_set.h:288
Definition: client_context.h:103
Straightforward wrapping of the C call object.
Definition: call.h:36
bool ok() const
Is the status OK?
Definition: status.h:125
Did it work? If it didn't, why?
Definition: status.h:34
@ 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:414
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:195
Codegen interface for grpc::Channel.
Definition: channel_interface.h:71
@ GRPC_CQ_PLUCK
Events are popped out by calling grpc_completion_queue_pluck() API ONLY.
Definition: grpc_types.h:434
Definition: grpc_types.h:462
BlockingUnaryCallImpl(ChannelInterface *channel, const RpcMethod &method, grpc::ClientContext *context, const InputMessage &request, OutputMessage *result)
Definition: client_unary_call.h:57
@ UNIMPLEMENTED
Operation is not implemented or not supported/enabled in this service.
Definition: status_code_enum.h:117
#define GRPC_CQ_CURRENT_VERSION
Definition: grpc_types.h:460
Definition: call_op_set.h:771
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue.h:105
Definition: call_op_set.h:426
Descriptor of an RPC method.
Definition: rpc_method.h:29
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:42
::absl::Status Status
Definition: config_protobuf.h:106
Status status()
Definition: client_unary_call.h:93