19 #ifndef GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H
20 #define GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H
37 class ServerInterface;
54 friend class ::grpc::ServerInterface;
55 virtual void BindCall(
Call* call) = 0;
66 for (
const auto& method : methods_) {
67 if (method && method->handler() ==
nullptr) {
75 for (
const auto& method : methods_) {
85 for (
const auto& method : methods_) {
86 if (method && (method->api_type() ==
97 for (
const auto& method : methods_) {
98 if (method.get() ==
nullptr) {
114 size_t idx =
static_cast<size_t>(index);
116 service_->methods_[idx].get() !=
nullptr &&
117 "Cannot mark the method as 'callback' because it has already been "
118 "marked as 'generic'.");
119 service_->methods_[idx]->SetHandler(handler);
120 service_->methods_[idx]->SetServerApiType(
127 size_t idx =
static_cast<size_t>(index);
129 service_->methods_[idx].get() !=
nullptr &&
130 "Cannot mark the method as 'raw callback' because it has already "
131 "been marked as 'generic'.");
132 service_->methods_[idx]->SetHandler(handler);
133 service_->methods_[idx]->SetServerApiType(
138 size_t idx =
static_cast<size_t>(index);
139 return service_->methods_[idx]->handler();
148 template <
class Message>
158 size_t idx =
static_cast<size_t>(index);
160 notification_cq, tag, request);
167 size_t idx =
static_cast<size_t>(index);
169 notification_cq, tag);
171 template <
class Message>
177 size_t idx =
static_cast<size_t>(index);
179 notification_cq, tag, request);
186 size_t idx =
static_cast<size_t>(index);
188 notification_cq, tag);
192 methods_.emplace_back(method);
198 size_t idx =
static_cast<size_t>(index);
200 methods_[idx].get() !=
nullptr &&
201 "Cannot mark the method as 'async' because it has already been "
202 "marked as 'generic'.");
209 size_t idx =
static_cast<size_t>(index);
211 "Cannot mark the method as 'raw' because it has already "
212 "been marked as 'generic'.");
219 size_t idx =
static_cast<size_t>(index);
221 methods_[idx]->handler() !=
nullptr &&
222 "Cannot mark the method as 'generic' because it has already been "
223 "marked as 'async' or 'raw'.");
224 methods_[idx].reset();
230 size_t idx =
static_cast<size_t>(index);
232 "Cannot mark an async or generic method Streamed");
233 methods_[idx]->SetHandler(streamed_method);
246 std::vector<std::unique_ptr<internal::RpcServiceMethod>> methods_;
Definition: server_interface.h:59
void RequestAsyncCall(internal::RpcServiceMethod *method, ::grpc_impl::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, ::grpc_impl::CompletionQueue *call_cq, ::grpc_impl::ServerCompletionQueue *notification_cq, void *tag, Message *message)
Definition: server_interface.h:329
Definition: service_type.h:107
void MarkMethodCallback(int index, internal::MethodHandler *handler)
Definition: service_type.h:111
experimental_type(Service *service)
Definition: service_type.h:109
internal::MethodHandler * GetHandler(int index)
Definition: service_type.h:137
void MarkMethodRawCallback(int index, internal::MethodHandler *handler)
Definition: service_type.h:124
Desriptor of an RPC service and its various RPC methods.
Definition: service_type.h:60
void RequestAsyncClientStreaming(int index, ::grpc_impl::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, ::grpc_impl::CompletionQueue *call_cq, ::grpc_impl::ServerCompletionQueue *notification_cq, void *tag)
Definition: service_type.h:162
void MarkMethodGeneric(int index)
Definition: service_type.h:216
bool has_callback_methods() const
Definition: service_type.h:84
void RequestAsyncServerStreaming(int index, ::grpc_impl::ServerContext *context, Message *request, internal::ServerAsyncStreamingInterface *stream, ::grpc_impl::CompletionQueue *call_cq, ::grpc_impl::ServerCompletionQueue *notification_cq, void *tag)
Definition: service_type.h:172
void MarkMethodStreamed(int index, internal::MethodHandler *streamed_method)
Definition: service_type.h:227
void RequestAsyncUnary(int index, ::grpc_impl::ServerContext *context, Message *request, internal::ServerAsyncStreamingInterface *stream, ::grpc_impl::CompletionQueue *call_cq, ::grpc_impl::ServerCompletionQueue *notification_cq, void *tag)
Definition: service_type.h:149
void RequestAsyncBidiStreaming(int index, ::grpc_impl::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, ::grpc_impl::CompletionQueue *call_cq, ::grpc_impl::ServerCompletionQueue *notification_cq, void *tag)
Definition: service_type.h:181
Service()
Definition: service_type.h:62
void MarkMethodRaw(int index)
Definition: service_type.h:206
bool has_generic_methods() const
Definition: service_type.h:96
experimental_type experimental()
Definition: service_type.h:146
void AddMethod(internal::RpcServiceMethod *method)
Definition: service_type.h:191
virtual ~Service()
Definition: service_type.h:63
bool has_synchronous_methods() const
Definition: service_type.h:74
void MarkMethodAsync(int index)
Definition: service_type.h:195
bool has_async_methods() const
Definition: service_type.h:65
Straightforward wrapping of the C call object.
Definition: call.h:38
Base class for running an RPC handler.
Definition: rpc_service_method.h:41
@ BIDI_STREAMING
Definition: rpc_method.h:35
Server side rpc method class.
Definition: rpc_service_method.h:87
Definition: service_type.h:41
virtual void SendInitialMetadata(void *tag)=0
Request notification of the sending of initial metadata to the client.
virtual ~ServerAsyncStreamingInterface()
Definition: service_type.h:43
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue_impl.h:100
A specific type of completion queue used by the processing of notifications by servers.
Definition: completion_queue_impl.h:389
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context_impl.h:488
Represents a gRPC server.
Definition: server_impl.h:62
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:146
::google::protobuf::Message Message
Definition: config_protobuf.h:75
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm_impl.h:33
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
::grpc_impl::Server Server
Definition: server.h:26
::grpc_impl::ServerContext ServerContext
Definition: server_context.h:26
::grpc_impl::CompletionQueue CompletionQueue
Definition: completion_queue.h:26