aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-02-09 12:47:21 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-02-09 12:47:21 -0800
commit5ef5db1d463cf23b06357613387a6ec21915bbdc (patch)
tree5dc5af239b45a962bf6ff71a7cdfa757f7d3ce90 /src
parent2dff17d33bd1487365880f2123a46494ce69681c (diff)
Async API declarations
Diffstat (limited to 'src')
-rw-r--r--src/compiler/cpp_generator.cc50
1 files changed, 35 insertions, 15 deletions
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index 1814bfa4f7..37cde1af9a 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -116,7 +116,8 @@ std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) {
"class RpcService;\n"
"class ServerContext;\n";
if (HasUnaryCalls(file)) {
- temp.append("template <class OutMessage> class ServerAsyncResponseWriter;\n");
+ temp.append(
+ "template <class OutMessage> class ServerAsyncResponseWriter;\n");
}
if (HasClientOnlyStreaming(file)) {
temp.append("template <class OutMessage> class ClientWriter;\n");
@@ -160,27 +161,45 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
if (NoStreaming(method)) {
printer->Print(*vars,
"::grpc::Status $Method$(::grpc::ClientContext* context, "
- "const $Request$& request, $Response$* response);\n\n");
+ "const $Request$& request, $Response$* response);\n");
+ printer->Print(*vars,
+ "void $Method$(::grpc::ClientContext* context, "
+ "const $Request$& request, $Response$* response, "
+ "Status *status, "
+ "CompletionQueue *cq, void *tag);\n");
} else if (ClientOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "::grpc::ClientWriter< $Request$>* $Method$("
- "::grpc::ClientContext* context, $Response$* response);\n\n");
+ printer->Print(*vars,
+ "::grpc::ClientWriter< $Request$>* $Method$("
+ "::grpc::ClientContext* context, $Response$* response);\n");
+ printer->Print(*vars,
+ "::grpc::ClientWriter< $Request$>* $Method$("
+ "::grpc::ClientContext* context, $Response$* response, "
+ "Status *status, "
+ "CompletionQueue *cq, void *tag);\n");
} else if (ServerOnlyStreaming(method)) {
printer->Print(
*vars,
"::grpc::ClientReader< $Response$>* $Method$("
- "::grpc::ClientContext* context, const $Request$* request);\n\n");
+ "::grpc::ClientContext* context, const $Request$* request);\n");
+ printer->Print(*vars,
+ "::grpc::ClientReader< $Response$>* $Method$("
+ "::grpc::ClientContext* context, const $Request$* request, "
+ "CompletionQueue *cq, void *tag);\n");
} else if (BidiStreaming(method)) {
printer->Print(*vars,
"::grpc::ClientReaderWriter< $Request$, $Response$>* "
- "$Method$(::grpc::ClientContext* context);\n\n");
+ "$Method$(::grpc::ClientContext* context);\n");
+ printer->Print(*vars,
+ "::grpc::ClientReaderWriter< $Request$, $Response$>* "
+ "$Method$(::grpc::ClientContext* context, "
+ "CompletionQueue *cq, void *tag);\n");
}
}
-void PrintHeaderServerMethodSync(google::protobuf::io::Printer *printer,
- const google::protobuf::MethodDescriptor *method,
- std::map<std::string, std::string> *vars) {
+void PrintHeaderServerMethodSync(
+ google::protobuf::io::Printer *printer,
+ const google::protobuf::MethodDescriptor *method,
+ std::map<std::string, std::string> *vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -212,9 +231,10 @@ void PrintHeaderServerMethodSync(google::protobuf::io::Printer *printer,
}
}
-void PrintHeaderServerMethodAsync(google::protobuf::io::Printer *printer,
- const google::protobuf::MethodDescriptor *method,
- std::map<std::string, std::string> *vars) {
+void PrintHeaderServerMethodAsync(
+ google::protobuf::io::Printer *printer,
+ const google::protobuf::MethodDescriptor *method,
+ std::map<std::string, std::string> *vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true);
@@ -245,7 +265,7 @@ void PrintHeaderServerMethodAsync(google::protobuf::io::Printer *printer,
"void $Method$("
"::grpc::ServerContext* context, "
"::grpc::ServerReaderWriter< $Response$, $Request$>* stream, "
- "::grpc::CompletionQueue* cq, void *tag);\n");
+ "::grpc::CompletionQueue* cq, void *tag);\n");
}
}