summaryrefslogtreecommitdiffstats
path: root/contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h
diff options
context:
space:
mode:
authorarcadia-devtools <[email protected]>2022-03-15 21:33:41 +0300
committerarcadia-devtools <[email protected]>2022-03-15 21:33:41 +0300
commit3dd665b514943f69657b593eb51af90b99b1206b (patch)
tree0eb633e628bb1fe6c639574b1184d43def7c0a73 /contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h
parenta68afc731202027f105bc5723ee11788017c29e2 (diff)
intermediate changes
ref:953ca886ec160075b38c0f3614de029b423f0a9e
Diffstat (limited to 'contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h')
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h
index 098bb50ee2c..d41ea1ad2d4 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h
@@ -20,6 +20,7 @@
#define GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
#include <grpcpp/impl/codegen/call.h>
+#include <grpcpp/impl/codegen/call_op_set.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/config.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
@@ -30,12 +31,23 @@ namespace grpc {
class ClientContext;
namespace internal {
class RpcMethod;
-/// Wrapper that performs a blocking unary call
-template <class InputMessage, class OutputMessage>
+
+/// Wrapper that performs a blocking unary call. May optionally specify the base
+/// class of the Request and Response so that the internal calls and structures
+/// below this may be based on those base classes and thus achieve code reuse
+/// across different RPCs (e.g., for protobuf, MessageLite would be a base
+/// class).
+template <class InputMessage, class OutputMessage,
+ class BaseInputMessage = InputMessage,
+ class BaseOutputMessage = OutputMessage>
Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method,
grpc::ClientContext* context,
const InputMessage& request, OutputMessage* result) {
- return BlockingUnaryCallImpl<InputMessage, OutputMessage>(
+ static_assert(std::is_base_of<BaseInputMessage, InputMessage>::value,
+ "Invalid input message specification");
+ static_assert(std::is_base_of<BaseOutputMessage, OutputMessage>::value,
+ "Invalid output message specification");
+ return BlockingUnaryCallImpl<BaseInputMessage, BaseOutputMessage>(
channel, method, context, request, result)
.status();
}