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
59 lines
2.2 KiB
C++
59 lines
2.2 KiB
C++
// Generated by the gRPC protobuf plugin.
|
|
// If you make any local change, they will be lost.
|
|
// source: echo.proto
|
|
|
|
#include "echo.pb.h"
|
|
#include "echo.grpc.pb.h"
|
|
|
|
#include <grpc++/impl/codegen/async_stream.h>
|
|
#include <grpc++/impl/codegen/async_unary_call.h>
|
|
#include <grpc++/impl/codegen/channel_interface.h>
|
|
#include <grpc++/impl/codegen/client_unary_call.h>
|
|
#include <grpc++/impl/codegen/method_handler_impl.h>
|
|
#include <grpc++/impl/codegen/rpc_service_method.h>
|
|
#include <grpc++/impl/codegen/service_type.h>
|
|
#include <grpc++/impl/codegen/sync_stream.h>
|
|
namespace echo {
|
|
|
|
static const char* Echo_method_names[] = {
|
|
"/echo.Echo/DoEcho",
|
|
};
|
|
|
|
std::unique_ptr< Echo::Stub> Echo::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
|
|
std::unique_ptr< Echo::Stub> stub(new Echo::Stub(channel));
|
|
return stub;
|
|
}
|
|
|
|
Echo::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
|
|
: channel_(channel), rpcmethod_DoEcho_(Echo_method_names[0], ::grpc::RpcMethod::NORMAL_RPC, channel)
|
|
{}
|
|
|
|
::grpc::Status Echo::Stub::DoEcho(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::echo::EchoRequest* response) {
|
|
return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_DoEcho_, context, request, response);
|
|
}
|
|
|
|
::grpc::ClientAsyncResponseReader< ::echo::EchoRequest>* Echo::Stub::AsyncDoEchoRaw(::grpc::ClientContext* context, const ::echo::EchoRequest& request, ::grpc::CompletionQueue* cq) {
|
|
return new ::grpc::ClientAsyncResponseReader< ::echo::EchoRequest>(channel_.get(), cq, rpcmethod_DoEcho_, context, request);
|
|
}
|
|
|
|
Echo::Service::Service() {
|
|
AddMethod(new ::grpc::RpcServiceMethod(
|
|
Echo_method_names[0],
|
|
::grpc::RpcMethod::NORMAL_RPC,
|
|
new ::grpc::RpcMethodHandler< Echo::Service, ::echo::EchoRequest, ::echo::EchoRequest>(
|
|
std::mem_fn(&Echo::Service::DoEcho), this)));
|
|
}
|
|
|
|
Echo::Service::~Service() {
|
|
}
|
|
|
|
::grpc::Status Echo::Service::DoEcho(::grpc::ServerContext* context, const ::echo::EchoRequest* request, ::echo::EchoRequest* response) {
|
|
(void) context;
|
|
(void) request;
|
|
(void) response;
|
|
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
|
}
|
|
|
|
|
|
} // namespace echo
|
|
|