synchronized grpc cpp_generator with latest version as of today: grpc-1.8.1. (#4556)
* updateed cpp_generator.cc to be compatible with the latest grpc version * preserved the original license * synchronized grpc cpp_generator with latest version as of today: GRPC 1.8.1. Regenerated test/monster_test.grpc.fb.* files and verified that grpctest is nicely passing * fixed merge glitch
This commit is contained in:
parent
dd73b53e28
commit
61f4a46c43
|
@ -244,7 +244,7 @@ if(FLATBUFFERS_BUILD_GRPCTEST)
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-shadow")
|
||||
endif()
|
||||
add_executable(grpctest ${FlatBuffers_GRPCTest_SRCS})
|
||||
target_link_libraries(grpctest grpc++_unsecure grpc_unsecure pthread dl)
|
||||
target_link_libraries(grpctest grpc++_unsecure grpc_unsecure gpr pthread dl)
|
||||
endif()
|
||||
|
||||
if(FLATBUFFERS_INSTALL)
|
||||
|
|
|
@ -159,7 +159,6 @@ grpc::string GetHeaderIncludes(grpc_generator::File *file,
|
|||
printer->Print(vars, "namespace grpc {\n");
|
||||
printer->Print(vars, "class CompletionQueue;\n");
|
||||
printer->Print(vars, "class Channel;\n");
|
||||
printer->Print(vars, "class RpcService;\n");
|
||||
printer->Print(vars, "class ServerCompletionQueue;\n");
|
||||
printer->Print(vars, "class ServerContext;\n");
|
||||
printer->Print(vars, "} // namespace grpc\n\n");
|
||||
|
@ -349,7 +348,8 @@ void PrintHeaderClientMethodInterfaces(
|
|||
} else if (ServerOnlyStreaming(method)) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"virtual ::grpc::ClientReaderInterface< $Response$>* $Method$Raw("
|
||||
"virtual ::grpc::ClientReaderInterface< $Response$>* "
|
||||
"$Method$Raw("
|
||||
"::grpc::ClientContext* context, const $Request$& request) = 0;\n");
|
||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
||||
auto& async_prefix = async_prefixes[i];
|
||||
|
@ -581,7 +581,8 @@ void PrintHeaderClientMethodData(grpc_generator::Printer *printer,
|
|||
const grpc_generator::Method *method,
|
||||
std::map<grpc::string, grpc::string> *vars) {
|
||||
(*vars)["Method"] = method->name();
|
||||
printer->Print(*vars, "const ::grpc::RpcMethod rpcmethod_$Method$_;\n");
|
||||
printer->Print(*vars,
|
||||
"const ::grpc::internal::RpcMethod rpcmethod_$Method$_;\n");
|
||||
}
|
||||
|
||||
void PrintHeaderServerMethodSync(grpc_generator::Printer *printer,
|
||||
|
@ -753,7 +754,7 @@ void PrintHeaderServerMethodStreamedUnary(
|
|||
printer->Print(*vars,
|
||||
"WithStreamedUnaryMethod_$Method$() {\n"
|
||||
" ::grpc::Service::MarkMethodStreamed($Idx$,\n"
|
||||
" new ::grpc::StreamedUnaryHandler< $Request$, "
|
||||
" new ::grpc::internal::StreamedUnaryHandler< $Request$, "
|
||||
"$Response$>(std::bind"
|
||||
"(&WithStreamedUnaryMethod_$Method$<BaseClass>::"
|
||||
"Streamed$Method$, this, std::placeholders::_1, "
|
||||
|
@ -801,15 +802,16 @@ void PrintHeaderServerMethodSplitStreaming(
|
|||
"{}\n");
|
||||
printer->Print(" public:\n");
|
||||
printer->Indent();
|
||||
printer->Print(*vars,
|
||||
"WithSplitStreamingMethod_$Method$() {\n"
|
||||
" ::grpc::Service::MarkMethodStreamed($Idx$,\n"
|
||||
" new ::grpc::SplitServerStreamingHandler< $Request$, "
|
||||
"$Response$>(std::bind"
|
||||
"(&WithSplitStreamingMethod_$Method$<BaseClass>::"
|
||||
"Streamed$Method$, this, std::placeholders::_1, "
|
||||
"std::placeholders::_2)));\n"
|
||||
"}\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
"WithSplitStreamingMethod_$Method$() {\n"
|
||||
" ::grpc::Service::MarkMethodStreamed($Idx$,\n"
|
||||
" new ::grpc::internal::SplitServerStreamingHandler< $Request$, "
|
||||
"$Response$>(std::bind"
|
||||
"(&WithSplitStreamingMethod_$Method$<BaseClass>::"
|
||||
"Streamed$Method$, this, std::placeholders::_1, "
|
||||
"std::placeholders::_2)));\n"
|
||||
"}\n");
|
||||
printer->Print(*vars,
|
||||
"~WithSplitStreamingMethod_$Method$() override {\n"
|
||||
" BaseClassMustBeDerivedFromService(this);\n"
|
||||
|
@ -949,7 +951,8 @@ void PrintHeaderService(grpc_generator::Printer *printer,
|
|||
" {\n public:\n");
|
||||
printer->Indent();
|
||||
printer->Print(
|
||||
"Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);\n");
|
||||
"Stub(const std::shared_ptr< ::grpc::ChannelInterface>& "
|
||||
"channel);\n");
|
||||
for (int i = 0; i < service->method_count(); ++i) {
|
||||
PrintHeaderClientMethod(printer, service->method(i).get(), vars, true);
|
||||
}
|
||||
|
@ -1220,10 +1223,9 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||
"::grpc::ClientContext* context, "
|
||||
"const $Request$& request, $Response$* response) {\n");
|
||||
printer->Print(*vars,
|
||||
" return ::grpc::BlockingUnaryCall(channel_.get(), "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, request, response);\n"
|
||||
"}\n\n");
|
||||
" return ::grpc::internal::BlockingUnaryCall"
|
||||
"(channel_.get(), rpcmethod_$Method$_, "
|
||||
"context, request, response);\n}\n\n");
|
||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
||||
auto& async_prefix = async_prefixes[i];
|
||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||
|
@ -1234,25 +1236,27 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||
"ClientContext* context, "
|
||||
"const $Request$& request, "
|
||||
"::grpc::CompletionQueue* cq) {\n");
|
||||
printer->Print(*vars,
|
||||
" return "
|
||||
"::grpc::ClientAsyncResponseReader< $Response$>::Create("
|
||||
"channel_.get(), cq, "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, request, $AsyncStart$);\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
" return "
|
||||
"::grpc::internal::ClientAsyncResponseReaderFactory< $Response$>"
|
||||
"::Create(channel_.get(), cq, "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, request, $AsyncStart$);\n"
|
||||
"}\n\n");
|
||||
}
|
||||
} else if (ClientOnlyStreaming(method)) {
|
||||
printer->Print(*vars,
|
||||
"::grpc::ClientWriter< $Request$>* "
|
||||
"$ns$$Service$::Stub::$Method$Raw("
|
||||
"::grpc::ClientContext* context, $Response$* response) {\n");
|
||||
printer->Print(*vars,
|
||||
" return new ::grpc::ClientWriter< $Request$>("
|
||||
"channel_.get(), "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, response);\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
" return ::grpc::internal::ClientWriterFactory< $Request$>::Create("
|
||||
"channel_.get(), "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, response);\n"
|
||||
"}\n\n");
|
||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
||||
auto& async_prefix = async_prefixes[i];
|
||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||
|
@ -1264,12 +1268,13 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||
"$ns$$Service$::Stub::$AsyncPrefix$$Method$Raw("
|
||||
"::grpc::ClientContext* context, $Response$* response, "
|
||||
"::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
|
||||
printer->Print(*vars,
|
||||
" return ::grpc::ClientAsyncWriter< $Request$>::Create("
|
||||
"channel_.get(), cq, "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, response, $AsyncStart$$AsyncCreateArgs$);\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
" return ::grpc::internal::ClientAsyncWriterFactory< $Request$>"
|
||||
"::Create(channel_.get(), cq, "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, response, $AsyncStart$$AsyncCreateArgs$);\n"
|
||||
"}\n\n");
|
||||
}
|
||||
} else if (ServerOnlyStreaming(method)) {
|
||||
printer->Print(
|
||||
|
@ -1277,12 +1282,13 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||
"::grpc::ClientReader< $Response$>* "
|
||||
"$ns$$Service$::Stub::$Method$Raw("
|
||||
"::grpc::ClientContext* context, const $Request$& request) {\n");
|
||||
printer->Print(*vars,
|
||||
" return new ::grpc::ClientReader< $Response$>("
|
||||
"channel_.get(), "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, request);\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
" return ::grpc::internal::ClientReaderFactory< $Response$>::Create("
|
||||
"channel_.get(), "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, request);\n"
|
||||
"}\n\n");
|
||||
for (size_t i = 0; i < sizeof(async_prefixes)/sizeof(async_prefixes[0]); i ++) {
|
||||
auto& async_prefix = async_prefixes[i];
|
||||
(*vars)["AsyncPrefix"] = async_prefix.prefix;
|
||||
|
@ -1295,12 +1301,13 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||
"$ns$$Service$::Stub::$AsyncPrefix$$Method$Raw("
|
||||
"::grpc::ClientContext* context, const $Request$& request, "
|
||||
"::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
|
||||
printer->Print(*vars,
|
||||
" return ::grpc::ClientAsyncReader< $Response$>::Create("
|
||||
"channel_.get(), cq, "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, request, $AsyncStart$$AsyncCreateArgs$);\n"
|
||||
"}\n\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
" return ::grpc::internal::ClientAsyncReaderFactory< $Response$>"
|
||||
"::Create(channel_.get(), cq, "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, request, $AsyncStart$$AsyncCreateArgs$);\n"
|
||||
"}\n\n");
|
||||
}
|
||||
} else if (method->BidiStreaming()) {
|
||||
printer->Print(
|
||||
|
@ -1308,8 +1315,8 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||
"::grpc::ClientReaderWriter< $Request$, $Response$>* "
|
||||
"$ns$$Service$::Stub::$Method$Raw(::grpc::ClientContext* context) {\n");
|
||||
printer->Print(*vars,
|
||||
" return new ::grpc::ClientReaderWriter< "
|
||||
"$Request$, $Response$>("
|
||||
" return ::grpc::internal::ClientReaderWriterFactory< "
|
||||
"$Request$, $Response$>::Create("
|
||||
"channel_.get(), "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context);\n"
|
||||
|
@ -1325,14 +1332,14 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer,
|
|||
"$ns$$Service$::Stub::$AsyncPrefix$$Method$Raw(::grpc::"
|
||||
"ClientContext* context, "
|
||||
"::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
|
||||
printer->Print(
|
||||
*vars,
|
||||
" return "
|
||||
"::grpc::ClientAsyncReaderWriter< $Request$, $Response$>::Create("
|
||||
"channel_.get(), cq, "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, $AsyncStart$$AsyncCreateArgs$);\n"
|
||||
"}\n\n");
|
||||
printer->Print(*vars,
|
||||
" return "
|
||||
"::grpc::internal::ClientAsyncReaderWriterFactory< "
|
||||
"$Request$, $Response$>::Create("
|
||||
"channel_.get(), cq, "
|
||||
"rpcmethod_$Method$_, "
|
||||
"context, $AsyncStart$$AsyncCreateArgs$);\n"
|
||||
"}\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1443,7 +1450,7 @@ void PrintSourceService(grpc_generator::Printer *printer,
|
|||
printer->Print(*vars,
|
||||
", rpcmethod_$Method$_("
|
||||
"$prefix$$Service$_method_names[$Idx$], "
|
||||
"::grpc::RpcMethod::$StreamingType$, "
|
||||
"::grpc::internal::RpcMethod::$StreamingType$, "
|
||||
"channel"
|
||||
")\n");
|
||||
}
|
||||
|
@ -1466,38 +1473,38 @@ void PrintSourceService(grpc_generator::Printer *printer,
|
|||
if (method->NoStreaming()) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"AddMethod(new ::grpc::RpcServiceMethod(\n"
|
||||
"AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
|
||||
" $prefix$$Service$_method_names[$Idx$],\n"
|
||||
" ::grpc::RpcMethod::NORMAL_RPC,\n"
|
||||
" new ::grpc::RpcMethodHandler< $ns$$Service$::Service, "
|
||||
" ::grpc::internal::RpcMethod::NORMAL_RPC,\n"
|
||||
" new ::grpc::internal::RpcMethodHandler< $ns$$Service$::Service, "
|
||||
"$Request$, "
|
||||
"$Response$>(\n"
|
||||
" std::mem_fn(&$ns$$Service$::Service::$Method$), this)));\n");
|
||||
} else if (ClientOnlyStreaming(method.get())) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"AddMethod(new ::grpc::RpcServiceMethod(\n"
|
||||
"AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
|
||||
" $prefix$$Service$_method_names[$Idx$],\n"
|
||||
" ::grpc::RpcMethod::CLIENT_STREAMING,\n"
|
||||
" new ::grpc::ClientStreamingHandler< "
|
||||
" ::grpc::internal::RpcMethod::CLIENT_STREAMING,\n"
|
||||
" new ::grpc::internal::ClientStreamingHandler< "
|
||||
"$ns$$Service$::Service, $Request$, $Response$>(\n"
|
||||
" std::mem_fn(&$ns$$Service$::Service::$Method$), this)));\n");
|
||||
} else if (ServerOnlyStreaming(method.get())) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"AddMethod(new ::grpc::RpcServiceMethod(\n"
|
||||
"AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
|
||||
" $prefix$$Service$_method_names[$Idx$],\n"
|
||||
" ::grpc::RpcMethod::SERVER_STREAMING,\n"
|
||||
" new ::grpc::ServerStreamingHandler< "
|
||||
" ::grpc::internal::RpcMethod::SERVER_STREAMING,\n"
|
||||
" new ::grpc::internal::ServerStreamingHandler< "
|
||||
"$ns$$Service$::Service, $Request$, $Response$>(\n"
|
||||
" std::mem_fn(&$ns$$Service$::Service::$Method$), this)));\n");
|
||||
} else if (method->BidiStreaming()) {
|
||||
printer->Print(
|
||||
*vars,
|
||||
"AddMethod(new ::grpc::RpcServiceMethod(\n"
|
||||
"AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
|
||||
" $prefix$$Service$_method_names[$Idx$],\n"
|
||||
" ::grpc::RpcMethod::BIDI_STREAMING,\n"
|
||||
" new ::grpc::BidiStreamingHandler< "
|
||||
" ::grpc::internal::RpcMethod::BIDI_STREAMING,\n"
|
||||
" new ::grpc::internal::BidiStreamingHandler< "
|
||||
"$ns$$Service$::Service, $Request$, $Response$>(\n"
|
||||
" std::mem_fn(&$ns$$Service$::Service::$Method$), this)));\n");
|
||||
}
|
||||
|
@ -1598,7 +1605,8 @@ grpc::string GetMockIncludes(grpc_generator::File *file,
|
|||
|
||||
static const char *headers_strs[] = {
|
||||
"grpc++/impl/codegen/async_stream.h",
|
||||
"grpc++/impl/codegen/sync_stream.h", "gmock/gmock.h",
|
||||
"grpc++/impl/codegen/sync_stream.h",
|
||||
"gmock/gmock.h",
|
||||
};
|
||||
std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
|
||||
PrintIncludes(printer.get(), headers, params);
|
||||
|
|
|
@ -27,36 +27,44 @@ std::unique_ptr< MonsterStorage::Stub> MonsterStorage::NewStub(const std::shared
|
|||
}
|
||||
|
||||
MonsterStorage::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
|
||||
: channel_(channel) , rpcmethod_Store_(MonsterStorage_method_names[0], ::grpc::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_Retrieve_(MonsterStorage_method_names[1], ::grpc::RpcMethod::SERVER_STREAMING, channel)
|
||||
: channel_(channel) , rpcmethod_Store_(MonsterStorage_method_names[0], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
|
||||
, rpcmethod_Retrieve_(MonsterStorage_method_names[1], ::grpc::internal::RpcMethod::SERVER_STREAMING, channel)
|
||||
{}
|
||||
|
||||
::grpc::Status MonsterStorage::Stub::Store(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, flatbuffers::grpc::Message<Stat>* response) {
|
||||
return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_Store_, context, request, response);
|
||||
return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_Store_, context, request, response);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_Store_, context, request);
|
||||
return ::grpc::internal::ClientAsyncResponseReaderFactory< flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_Store_, context, request, true);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncResponseReaderFactory< flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_Store_, context, request, false);
|
||||
}
|
||||
|
||||
::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
|
||||
return new ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>(channel_.get(), rpcmethod_Retrieve_, context, request);
|
||||
return ::grpc::internal::ClientReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), rpcmethod_Retrieve_, context, request);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
|
||||
return ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_Retrieve_, context, request, tag);
|
||||
return ::grpc::internal::ClientAsyncReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_Retrieve_, context, request, true, tag);
|
||||
}
|
||||
|
||||
::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
|
||||
return ::grpc::internal::ClientAsyncReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_Retrieve_, context, request, false, nullptr);
|
||||
}
|
||||
|
||||
MonsterStorage::Service::Service() {
|
||||
AddMethod(new ::grpc::RpcServiceMethod(
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
MonsterStorage_method_names[0],
|
||||
::grpc::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::RpcMethodHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(
|
||||
::grpc::internal::RpcMethod::NORMAL_RPC,
|
||||
new ::grpc::internal::RpcMethodHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(
|
||||
std::mem_fn(&MonsterStorage::Service::Store), this)));
|
||||
AddMethod(new ::grpc::RpcServiceMethod(
|
||||
AddMethod(new ::grpc::internal::RpcServiceMethod(
|
||||
MonsterStorage_method_names[1],
|
||||
::grpc::RpcMethod::SERVER_STREAMING,
|
||||
new ::grpc::ServerStreamingHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>(
|
||||
::grpc::internal::RpcMethod::SERVER_STREAMING,
|
||||
new ::grpc::internal::ServerStreamingHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>(
|
||||
std::mem_fn(&MonsterStorage::Service::Retrieve), this)));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#ifndef GRPC_monster_5ftest__INCLUDED
|
||||
#define GRPC_monster_5ftest__INCLUDED
|
||||
|
||||
#include "flatbuffers/grpc.h"
|
||||
#include "monster_test_generated.h"
|
||||
#include "flatbuffers/grpc.h"
|
||||
|
||||
#include <grpc++/impl/codegen/async_stream.h>
|
||||
#include <grpc++/impl/codegen/async_unary_call.h>
|
||||
|
@ -20,7 +20,6 @@
|
|||
namespace grpc {
|
||||
class CompletionQueue;
|
||||
class Channel;
|
||||
class RpcService;
|
||||
class ServerCompletionQueue;
|
||||
class ServerContext;
|
||||
} // namespace grpc
|
||||
|
@ -40,16 +39,24 @@ class MonsterStorage final {
|
|||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>> AsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>>(AsyncStoreRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>> PrepareAsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>>(PrepareAsyncStoreRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>> Retrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
|
||||
return std::unique_ptr< ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>>(RetrieveRaw(context, request));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>> AsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>>(AsyncRetrieveRaw(context, request, cq, tag));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>> PrepareAsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncRetrieveRaw(context, request, cq));
|
||||
}
|
||||
private:
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>* AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>* PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
virtual ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>* RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) = 0;
|
||||
virtual ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>* AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) = 0;
|
||||
virtual ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>* PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) = 0;
|
||||
};
|
||||
class Stub final : public StubInterface {
|
||||
public:
|
||||
|
@ -58,20 +65,28 @@ class MonsterStorage final {
|
|||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>> AsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>>(AsyncStoreRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>> PrepareAsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>>(PrepareAsyncStoreRaw(context, request, cq));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>> Retrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
|
||||
return std::unique_ptr< ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>>(RetrieveRaw(context, request));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>> AsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>>(AsyncRetrieveRaw(context, request, cq, tag));
|
||||
}
|
||||
std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>> PrepareAsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
|
||||
return std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncRetrieveRaw(context, request, cq));
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr< ::grpc::ChannelInterface> channel_;
|
||||
::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) override;
|
||||
::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>* RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) override;
|
||||
::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) override;
|
||||
const ::grpc::RpcMethod rpcmethod_Store_;
|
||||
const ::grpc::RpcMethod rpcmethod_Retrieve_;
|
||||
::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) override;
|
||||
const ::grpc::internal::RpcMethod rpcmethod_Store_;
|
||||
const ::grpc::internal::RpcMethod rpcmethod_Retrieve_;
|
||||
};
|
||||
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
|
||||
|
||||
|
@ -164,7 +179,7 @@ class MonsterStorage final {
|
|||
public:
|
||||
WithStreamedUnaryMethod_Store() {
|
||||
::grpc::Service::MarkMethodStreamed(0,
|
||||
new ::grpc::StreamedUnaryHandler< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(std::bind(&WithStreamedUnaryMethod_Store<BaseClass>::StreamedStore, this, std::placeholders::_1, std::placeholders::_2)));
|
||||
new ::grpc::internal::StreamedUnaryHandler< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(std::bind(&WithStreamedUnaryMethod_Store<BaseClass>::StreamedStore, this, std::placeholders::_1, std::placeholders::_2)));
|
||||
}
|
||||
~WithStreamedUnaryMethod_Store() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
|
@ -185,7 +200,7 @@ class MonsterStorage final {
|
|||
public:
|
||||
WithSplitStreamingMethod_Retrieve() {
|
||||
::grpc::Service::MarkMethodStreamed(1,
|
||||
new ::grpc::SplitServerStreamingHandler< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>(std::bind(&WithSplitStreamingMethod_Retrieve<BaseClass>::StreamedRetrieve, this, std::placeholders::_1, std::placeholders::_2)));
|
||||
new ::grpc::internal::SplitServerStreamingHandler< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>(std::bind(&WithSplitStreamingMethod_Retrieve<BaseClass>::StreamedRetrieve, this, std::placeholders::_1, std::placeholders::_2)));
|
||||
}
|
||||
~WithSplitStreamingMethod_Retrieve() override {
|
||||
BaseClassMustBeDerivedFromService(this);
|
||||
|
|
Loading…
Reference in New Issue