mirror of
https://github.com/unclechu/gRPC-haskell.git
synced 2024-11-30 06:59:43 +01:00
ce56953b24
* initial echo client/server examples * registered and unregistered versions of the example client * ignore pyc files * cpp echo code, flag to build examples * threaded server example
103 lines
4.5 KiB
C++
103 lines
4.5 KiB
C++
// Generated by the gRPC protobuf plugin.
|
|
// If you make any local change, they will be lost.
|
|
// source: echo.proto
|
|
#ifndef GRPC_echo_2eproto__INCLUDED
|
|
#define GRPC_echo_2eproto__INCLUDED
|
|
|
|
#include "echo.pb.h"
|
|
|
|
#include <grpc++/impl/codegen/async_stream.h>
|
|
#include <grpc++/impl/codegen/async_unary_call.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>
|
|
#include <grpc++/impl/codegen/stub_options.h>
|
|
#include <grpc++/impl/codegen/sync_stream.h>
|
|
|
|
namespace grpc {
|
|
class CompletionQueue;
|
|
class RpcService;
|
|
class ServerCompletionQueue;
|
|
class ServerContext;
|
|
} // namespace grpc
|
|
|
|
namespace echo {
|
|
|
|
class Echo GRPC_FINAL {
|
|
public:
|
|
class StubInterface {
|
|
public:
|
|
virtual ~StubInterface() {}
|
|
virtual ::grpc::Status DoEcho(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::echo::EchoRequest* response) = 0;
|
|
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::echo::EchoRequest>> AsyncDoEcho(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::grpc::CompletionQueue* cq) {
|
|
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::echo::EchoRequest>>(AsyncDoEchoRaw(context, request, cq));
|
|
}
|
|
private:
|
|
virtual ::grpc::ClientAsyncResponseReaderInterface< ::echo::EchoRequest>* AsyncDoEchoRaw(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::grpc::CompletionQueue* cq) = 0;
|
|
};
|
|
class Stub GRPC_FINAL : public StubInterface {
|
|
public:
|
|
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
|
|
::grpc::Status DoEcho(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::echo::EchoRequest* response) GRPC_OVERRIDE;
|
|
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::echo::EchoRequest>> AsyncDoEcho(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::grpc::CompletionQueue* cq) {
|
|
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::echo::EchoRequest>>(AsyncDoEchoRaw(context, request, cq));
|
|
}
|
|
|
|
private:
|
|
std::shared_ptr< ::grpc::ChannelInterface> channel_;
|
|
::grpc::ClientAsyncResponseReader< ::echo::EchoRequest>* AsyncDoEchoRaw(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE;
|
|
const ::grpc::RpcMethod rpcmethod_DoEcho_;
|
|
};
|
|
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
|
|
|
|
class Service : public ::grpc::Service {
|
|
public:
|
|
Service();
|
|
virtual ~Service();
|
|
virtual ::grpc::Status DoEcho(::grpc::ServerContext* context, const ::echo::EchoRequest* request, ::echo::EchoRequest* response);
|
|
};
|
|
template <class BaseClass>
|
|
class WithAsyncMethod_DoEcho : public BaseClass {
|
|
private:
|
|
void BaseClassMustBeDerivedFromService(Service *service) {}
|
|
public:
|
|
WithAsyncMethod_DoEcho() {
|
|
::grpc::Service::MarkMethodAsync(0);
|
|
}
|
|
~WithAsyncMethod_DoEcho() GRPC_OVERRIDE {
|
|
BaseClassMustBeDerivedFromService(this);
|
|
}
|
|
// disable synchronous version of this method
|
|
::grpc::Status DoEcho(::grpc::ServerContext* context, const ::echo::EchoRequest* request, ::echo::EchoRequest* response) GRPC_FINAL GRPC_OVERRIDE {
|
|
abort();
|
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
|
}
|
|
void RequestDoEcho(::grpc::ServerContext* context, ::echo::EchoRequest* request, ::grpc::ServerAsyncResponseWriter< ::echo::EchoRequest>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
|
|
::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
|
|
}
|
|
};
|
|
typedef WithAsyncMethod_DoEcho<Service > AsyncService;
|
|
template <class BaseClass>
|
|
class WithGenericMethod_DoEcho : public BaseClass {
|
|
private:
|
|
void BaseClassMustBeDerivedFromService(Service *service) {}
|
|
public:
|
|
WithGenericMethod_DoEcho() {
|
|
::grpc::Service::MarkMethodGeneric(0);
|
|
}
|
|
~WithGenericMethod_DoEcho() GRPC_OVERRIDE {
|
|
BaseClassMustBeDerivedFromService(this);
|
|
}
|
|
// disable synchronous version of this method
|
|
::grpc::Status DoEcho(::grpc::ServerContext* context, const ::echo::EchoRequest* request, ::echo::EchoRequest* response) GRPC_FINAL GRPC_OVERRIDE {
|
|
abort();
|
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
|
}
|
|
};
|
|
};
|
|
|
|
} // namespace echo
|
|
|
|
|
|
#endif // GRPC_echo_2eproto__INCLUDED
|