aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/server_async.cc
diff options
context:
space:
mode:
authorGravatar vjpai <vpai@google.com>2015-02-27 23:47:12 -0800
committerGravatar vjpai <vpai@google.com>2015-02-27 23:47:12 -0800
commit4e1e1bc28e9c95333a730889bc1a09581731ae2b (patch)
tree6536356da296e11939716cb807eecdae15999364 /test/cpp/qps/server_async.cc
parent45b0bc4bec5d0b701dbe5ae98542473ef3eaa4e4 (diff)
Revert "Use typedefs to avoid triply-nested function templates"
This reverts commit 45b0bc4bec5d0b701dbe5ae98542473ef3eaa4e4. This revert is being done because the compilers on Travis don't understand the C++11 template/using syntax.
Diffstat (limited to 'test/cpp/qps/server_async.cc')
-rw-r--r--test/cpp/qps/server_async.cc29
1 files changed, 16 insertions, 13 deletions
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 3d6379b73f..c797d8af96 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -183,19 +183,15 @@ class AsyncQpsServerTest {
return reinterpret_cast<ServerRpcContext *>(tag);
}
- template<class RequestType, class ResponseType>
- using RequestMethod = std::function<void(ServerContext *, RequestType *,
- grpc::ServerAsyncResponseWriter<ResponseType> *,
- void *)>;
- template<class RequestType, class ResponseType> using InvokeMethod =
- std::function<grpc::Status(const RequestType *, ResponseType *)>;
-
template <class RequestType, class ResponseType>
class ServerRpcContextUnaryImpl : public ServerRpcContext {
public:
ServerRpcContextUnaryImpl(
- RequestMethod<RequestType,ResponseType> request_method,
- InvokeMethod<RequestType,ResponseType> invoke_method)
+ std::function<void(ServerContext *, RequestType *,
+ grpc::ServerAsyncResponseWriter<ResponseType> *,
+ void *)> request_method,
+ std::function<grpc::Status(const RequestType *, ResponseType *)>
+ invoke_method)
: next_state_(&ServerRpcContextUnaryImpl::invoker),
request_method_(request_method),
invoke_method_(invoke_method),
@@ -233,8 +229,11 @@ class AsyncQpsServerTest {
ServerContext srv_ctx_;
RequestType req_;
bool (ServerRpcContextUnaryImpl::*next_state_)();
- RequestMethod<RequestType,ResponseType> request_method_;
- InvokeMethod<RequestType,ResponseType> invoke_method_;
+ std::function<void(ServerContext *, RequestType *,
+ grpc::ServerAsyncResponseWriter<ResponseType> *, void *)>
+ request_method_;
+ std::function<grpc::Status(const RequestType *, ResponseType *)>
+ invoke_method_;
grpc::ServerAsyncResponseWriter<ResponseType> response_writer_;
};
@@ -262,8 +261,12 @@ class AsyncQpsServerTest {
CompletionQueue srv_cq_;
TestService::AsyncService async_service_;
std::unique_ptr<Server> server_;
- RequestMethod<SimpleRequest, SimpleResponse> request_unary_;
- RequestMethod<StatsRequest, ServerStats> request_stats_;
+ std::function<void(ServerContext *, SimpleRequest *,
+ grpc::ServerAsyncResponseWriter<SimpleResponse> *, void *)>
+ request_unary_;
+ std::function<void(ServerContext *, StatsRequest *,
+ grpc::ServerAsyncResponseWriter<ServerStats> *, void *)>
+ request_stats_;
std::forward_list<ServerRpcContext *> contexts_;
};