aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar vjpai <vpai@google.com>2016-06-22 15:49:48 -0700
committerGravatar vjpai <vpai@google.com>2016-06-22 15:49:48 -0700
commitba6597f297b1cc1a8d91ca9154fee81c1639acdd (patch)
treea322eabe48181ea0b26b52f1ad37248c6024a699
parent726561ed062c6bb3635b48044bc5bb00de31e97e (diff)
Actually generate code for FC Unary and make it work
-rw-r--r--include/grpc++/impl/codegen/fc_unary.h1
-rw-r--r--src/compiler/cpp_generator.cc11
2 files changed, 10 insertions, 2 deletions
diff --git a/include/grpc++/impl/codegen/fc_unary.h b/include/grpc++/impl/codegen/fc_unary.h
index abb204939d..c5e44ca0fd 100644
--- a/include/grpc++/impl/codegen/fc_unary.h
+++ b/include/grpc++/impl/codegen/fc_unary.h
@@ -35,6 +35,7 @@
#define GRPCXX_IMPL_CODEGEN_FC_UNARY_H
#include <grpc++/impl/codegen/call.h>
+#include <grpc++/impl/codegen/completion_queue.h>
#include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/server_context.h>
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index e5db84ab11..eadbb3be85 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -128,6 +128,7 @@ grpc::string GetHeaderIncludes(File *file,
static const char *headers_strs[] = {
"grpc++/impl/codegen/async_stream.h",
"grpc++/impl/codegen/async_unary_call.h",
+ "grpc++/impl/codegen/fc_unary.h",
"grpc++/impl/codegen/proto_utils.h",
"grpc++/impl/codegen/rpc_method.h",
"grpc++/impl/codegen/service_type.h",
@@ -642,9 +643,8 @@ void PrintHeaderServerMethodFCUnary(
*vars,
"// replace default version of this method with FCUnary\n"
"::grpc::Status $Method$("
- "::grpc::ServerContext* context, ::grpc::FCUnary<$Request$,$Response$>* streaming_unary)"
+ "::grpc::ServerContext* context, ::grpc::FCUnary< $Request$,$Response$>* streaming_unary)"
" GRPC_FINAL GRPC_OVERRIDE;\n");
- printer->Print("}\n");
printer->Outdent();
printer->Print(*vars, "};\n");
}
@@ -815,6 +815,12 @@ void PrintHeaderService(Printer *printer,
PrintHeaderServerMethodGeneric(printer, service->method(i).get(), vars);
}
+ // Server side - FC Unary
+ for (int i = 0; i < service->method_count(); ++i) {
+ (*vars)["Idx"] = as_string(i);
+ PrintHeaderServerMethodFCUnary(printer, service->method(i).get(), vars);
+ }
+
printer->Outdent();
printer->Print("};\n");
printer->Print(service->GetTrailingComments().c_str());
@@ -917,6 +923,7 @@ grpc::string GetSourceIncludes(File *file,
"grpc++/impl/codegen/async_unary_call.h",
"grpc++/impl/codegen/channel_interface.h",
"grpc++/impl/codegen/client_unary_call.h",
+ "grpc++/impl/codegen/fc_unary.h",
"grpc++/impl/codegen/method_handler_impl.h",
"grpc++/impl/codegen/rpc_service_method.h",
"grpc++/impl/codegen/service_type.h",