summaryrefslogtreecommitdiff
path: root/tests/monster_test.grpc.fb.h
diff options
context:
space:
mode:
authorPer Grön <per.eckerdal@gmail.com>2017-05-12 18:48:17 +0200
committerWouter van Oortmerssen <aardappel@gmail.com>2017-05-12 09:48:17 -0700
commit9aeeddf5ac31c36cd5cf0e8b56f387eb942cd1ab (patch)
tree8a2dcc8b8993a33e0ee9c352fc9a23a779510659 /tests/monster_test.grpc.fb.h
parentc7bfe06c54bcd43312ff017e8ca32bc54833d524 (diff)
downloadflatbuffers-9aeeddf5ac31c36cd5cf0e8b56f387eb942cd1ab.tar.gz
flatbuffers-9aeeddf5ac31c36cd5cf0e8b56f387eb942cd1ab.tar.bz2
flatbuffers-9aeeddf5ac31c36cd5cf0e8b56f387eb942cd1ab.zip
C++/Go: Update gRPC related code to work with gRPC 1.3+ (#4305)
* Don't fail the build on unused parameters gRPC headers have unused parameters so this breaks the test build. * Pull in updated compiler files from gRPC There have been some API breaks in gRPC lately. This commit pulls in the most recent version of the files in this repo that are just copied from gRPC. * Modify the gRPC files so that they can work with Flatbuffers The files taken from gRPC do not work out-of-the-box with Flatbuffers. This commit modifies them so that they work. Hopefully this commit will be able to serve as a guide or maybe even be cherry-picked on top of new versions of those files as newer versions from gRPC are pulled in. * Adjust the rest of Flatbuffers to work with the new gRPC * Change idl_gen_grpc.cpp to work with the new API * Add missing #include in flatbuffers/grpc.h * Run tests/generate_code.sh and check in the results * Don't link with grpc++_unsecure and (secure) grpc. That's just weird * Revert unrelated JS/TS test changes * Simplify compiler/config.h There is no need to import this file from gRPC. In fact, it probably makes sense to not do so, since it seems to be intended to have project specific configuration in it. * Don't emit C++ types in the Go gRPC code generator * Don't emit C++ #includes in generated gRPC code Before this PR, there was a Go-specific additional_includes method in schema_interface.h, which is shared with the gRPC repo. The additional parameter to FlatBufFile in idl_gen_grpc.cpp makes that unnecessary, which means we need less Flatbuffer-specific changes in gRPC.
Diffstat (limited to 'tests/monster_test.grpc.fb.h')
-rw-r--r--tests/monster_test.grpc.fb.h92
1 files changed, 70 insertions, 22 deletions
diff --git a/tests/monster_test.grpc.fb.h b/tests/monster_test.grpc.fb.h
index 8228d7ad..a838e532 100644
--- a/tests/monster_test.grpc.fb.h
+++ b/tests/monster_test.grpc.fb.h
@@ -1,14 +1,16 @@
-// Generated by the gRPC protobuf plugin.
+// Generated by the gRPC C++ plugin.
// If you make any local change, they will be lost.
// source: monster_test
#ifndef GRPC_monster_5ftest__INCLUDED
#define GRPC_monster_5ftest__INCLUDED
-#include "monster_test_generated.h"
#include "flatbuffers/grpc.h"
+#include "monster_test_generated.h"
#include <grpc++/impl/codegen/async_stream.h>
#include <grpc++/impl/codegen/async_unary_call.h>
+#include <grpc++/impl/codegen/method_handler_impl.h>
+#include <grpc++/impl/codegen/proto_utils.h>
#include <grpc++/impl/codegen/rpc_method.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/status.h>
@@ -26,30 +28,33 @@ class ServerContext;
namespace MyGame {
namespace Example {
-class MonsterStorage GRPC_FINAL {
+class MonsterStorage final {
public:
+ static constexpr char const* service_full_name() {
+ return "MyGame.Example.MonsterStorage";
+ }
class StubInterface {
public:
virtual ~StubInterface() {}
- virtual ::grpc::Status Store(::grpc::ClientContext* context, const flatbuffers::BufferRef<Monster>& request, flatbuffers::BufferRef<Stat>* response) = 0;
+ virtual ::grpc::Status Store(::grpc::ClientContext* context, const flatbuffers::BufferRef<Monster>& request, flatbuffers::BufferRef<Stat>* response) = 0;
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::BufferRef<Stat>>> AsyncStore(::grpc::ClientContext* context, const flatbuffers::BufferRef<Monster>& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::BufferRef<Stat>>>(AsyncStoreRaw(context, request, cq));
}
- std::unique_ptr< ::grpc::ClientReaderInterface< flatbuffers::BufferRef<Monster>>> Retrieve(::grpc::ClientContext* context, const flatbuffers::BufferRef<Stat>& request) {
+ std::unique_ptr< ::grpc::ClientReaderInterface< flatbuffers::BufferRef<Monster>>> Retrieve(::grpc::ClientContext* context, const flatbuffers::BufferRef<Stat>& request) {
return std::unique_ptr< ::grpc::ClientReaderInterface< flatbuffers::BufferRef<Monster>>>(RetrieveRaw(context, request));
}
std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::BufferRef<Monster>>> AsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::BufferRef<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::BufferRef<Monster>>>(AsyncRetrieveRaw(context, request, cq, tag));
}
- private:
+ private:
virtual ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::BufferRef<Stat>>* AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::BufferRef<Monster>& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientReaderInterface< flatbuffers::BufferRef<Monster>>* RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::BufferRef<Stat>& request) = 0;
virtual ::grpc::ClientAsyncReaderInterface< flatbuffers::BufferRef<Monster>>* AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::BufferRef<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) = 0;
};
- class Stub GRPC_FINAL : public StubInterface {
+ class Stub final : public StubInterface {
public:
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
- ::grpc::Status Store(::grpc::ClientContext* context, const flatbuffers::BufferRef<Monster>& request, flatbuffers::BufferRef<Stat>* response) GRPC_OVERRIDE;
+ ::grpc::Status Store(::grpc::ClientContext* context, const flatbuffers::BufferRef<Monster>& request, flatbuffers::BufferRef<Stat>* response) override;
std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::BufferRef<Stat>>> AsyncStore(::grpc::ClientContext* context, const flatbuffers::BufferRef<Monster>& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::BufferRef<Stat>>>(AsyncStoreRaw(context, request, cq));
}
@@ -62,9 +67,9 @@ class MonsterStorage GRPC_FINAL {
private:
std::shared_ptr< ::grpc::ChannelInterface> channel_;
- ::grpc::ClientAsyncResponseReader< flatbuffers::BufferRef<Stat>>* AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::BufferRef<Monster>& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE;
- ::grpc::ClientReader< flatbuffers::BufferRef<Monster>>* RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::BufferRef<Stat>& request) GRPC_OVERRIDE;
- ::grpc::ClientAsyncReader< flatbuffers::BufferRef<Monster>>* AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::BufferRef<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE;
+ ::grpc::ClientAsyncResponseReader< flatbuffers::BufferRef<Stat>>* AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::BufferRef<Monster>& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientReader< flatbuffers::BufferRef<Monster>>* RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::BufferRef<Stat>& request) override;
+ ::grpc::ClientAsyncReader< flatbuffers::BufferRef<Monster>>* AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::BufferRef<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) override;
const ::grpc::RpcMethod rpcmethod_Store_;
const ::grpc::RpcMethod rpcmethod_Retrieve_;
};
@@ -74,9 +79,9 @@ class MonsterStorage GRPC_FINAL {
public:
Service();
virtual ~Service();
- virtual ::grpc::Status Store(::grpc::ServerContext* context, const flatbuffers::BufferRef<Monster>* request, flatbuffers::BufferRef<Stat>* response);
- virtual ::grpc::Status Retrieve(::grpc::ServerContext* context, const flatbuffers::BufferRef<Stat>* request, ::grpc::ServerWriter< flatbuffers::BufferRef<Monster>>* writer);
- };
+ virtual ::grpc::Status Store(::grpc::ServerContext* context, const flatbuffers::BufferRef<Monster>* request, flatbuffers::BufferRef<Stat>* response);
+ virtual ::grpc::Status Retrieve(::grpc::ServerContext* context, const flatbuffers::BufferRef<Stat>* request, ::grpc::ServerWriter< flatbuffers::BufferRef<Monster>>* writer);
+ };
template <class BaseClass>
class WithAsyncMethod_Store : public BaseClass {
private:
@@ -85,11 +90,11 @@ class MonsterStorage GRPC_FINAL {
WithAsyncMethod_Store() {
::grpc::Service::MarkMethodAsync(0);
}
- ~WithAsyncMethod_Store() GRPC_OVERRIDE {
+ ~WithAsyncMethod_Store() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status Store(::grpc::ServerContext* context, const flatbuffers::BufferRef<Monster>* request, flatbuffers::BufferRef<Stat>* response) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status Store(::grpc::ServerContext* context, const flatbuffers::BufferRef<Monster>* request, flatbuffers::BufferRef<Stat>* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
@@ -105,11 +110,11 @@ class MonsterStorage GRPC_FINAL {
WithAsyncMethod_Retrieve() {
::grpc::Service::MarkMethodAsync(1);
}
- ~WithAsyncMethod_Retrieve() GRPC_OVERRIDE {
+ ~WithAsyncMethod_Retrieve() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status Retrieve(::grpc::ServerContext* context, const flatbuffers::BufferRef<Stat>* request, ::grpc::ServerWriter< flatbuffers::BufferRef<Monster>>* writer) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status Retrieve(::grpc::ServerContext* context, const flatbuffers::BufferRef<Stat>* request, ::grpc::ServerWriter< flatbuffers::BufferRef<Monster>>* writer) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
@@ -126,11 +131,11 @@ class MonsterStorage GRPC_FINAL {
WithGenericMethod_Store() {
::grpc::Service::MarkMethodGeneric(0);
}
- ~WithGenericMethod_Store() GRPC_OVERRIDE {
+ ~WithGenericMethod_Store() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status Store(::grpc::ServerContext* context, const flatbuffers::BufferRef<Monster>* request, flatbuffers::BufferRef<Stat>* response) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status Store(::grpc::ServerContext* context, const flatbuffers::BufferRef<Monster>* request, flatbuffers::BufferRef<Stat>* response) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
@@ -143,15 +148,58 @@ class MonsterStorage GRPC_FINAL {
WithGenericMethod_Retrieve() {
::grpc::Service::MarkMethodGeneric(1);
}
- ~WithGenericMethod_Retrieve() GRPC_OVERRIDE {
+ ~WithGenericMethod_Retrieve() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status Retrieve(::grpc::ServerContext* context, const flatbuffers::BufferRef<Stat>* request, ::grpc::ServerWriter< flatbuffers::BufferRef<Monster>>* writer) GRPC_FINAL GRPC_OVERRIDE {
+ ::grpc::Status Retrieve(::grpc::ServerContext* context, const flatbuffers::BufferRef<Stat>* request, ::grpc::ServerWriter< flatbuffers::BufferRef<Monster>>* writer) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithStreamedUnaryMethod_Store : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service *service) {}
+ public:
+ WithStreamedUnaryMethod_Store() {
+ ::grpc::Service::MarkMethodStreamed(0,
+ new ::grpc::StreamedUnaryHandler< flatbuffers::BufferRef<Monster>, flatbuffers::BufferRef<Stat>>(std::bind(&WithStreamedUnaryMethod_Store<BaseClass>::StreamedStore, this, std::placeholders::_1, std::placeholders::_2)));
+ }
+ ~WithStreamedUnaryMethod_Store() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status Store(::grpc::ServerContext* context, const flatbuffers::BufferRef<Monster>* request, flatbuffers::BufferRef<Stat>* response) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with streamed unary
+ virtual ::grpc::Status StreamedStore(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< flatbuffers::BufferRef<Monster>,flatbuffers::BufferRef<Stat>>* server_unary_streamer) = 0;
+ };
+ typedef WithStreamedUnaryMethod_Store< Service > StreamedUnaryService;
+ template <class BaseClass>
+ class WithSplitStreamingMethod_Retrieve : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service *service) {}
+ public:
+ WithSplitStreamingMethod_Retrieve() {
+ ::grpc::Service::MarkMethodStreamed(1,
+ new ::grpc::SplitServerStreamingHandler< flatbuffers::BufferRef<Stat>, flatbuffers::BufferRef<Monster>>(std::bind(&WithSplitStreamingMethod_Retrieve<BaseClass>::StreamedRetrieve, this, std::placeholders::_1, std::placeholders::_2)));
+ }
+ ~WithSplitStreamingMethod_Retrieve() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status Retrieve(::grpc::ServerContext* context, const flatbuffers::BufferRef<Stat>* request, ::grpc::ServerWriter< flatbuffers::BufferRef<Monster>>* writer) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
+ // replace default version of method with split streamed
+ virtual ::grpc::Status StreamedRetrieve(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< flatbuffers::BufferRef<Stat>,flatbuffers::BufferRef<Monster>>* server_split_streamer) = 0;
};
+ typedef WithSplitStreamingMethod_Retrieve< Service > SplitStreamedService;
+ typedef WithStreamedUnaryMethod_Store< WithSplitStreamingMethod_Retrieve< Service > > StreamedService;
};
} // namespace Example