19 #ifndef GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H
20 #define GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H
31 class CompletionQueue;
33 class ServerInterface;
50 friend class ::grpc::ServerInterface;
51 virtual void BindCall(
Call* call) = 0;
62 for (
const auto& method : methods_) {
63 if (method && method->handler() ==
nullptr) {
71 for (
const auto& method : methods_) {
81 for (
const auto& method : methods_) {
82 if (method && (method->api_type() ==
93 for (
const auto& method : methods_) {
94 if (method ==
nullptr) {
102 template <
class Message>
112 size_t idx =
static_cast<size_t>(index);
114 notification_cq, tag, request);
121 size_t idx =
static_cast<size_t>(index);
123 notification_cq, tag);
125 template <
class Message>
131 size_t idx =
static_cast<size_t>(index);
133 notification_cq, tag, request);
140 size_t idx =
static_cast<size_t>(index);
142 notification_cq, tag);
146 methods_.emplace_back(method);
152 size_t idx =
static_cast<size_t>(index);
154 methods_[idx].get() !=
nullptr &&
155 "Cannot mark the method as 'async' because it has already been "
156 "marked as 'generic'.");
163 size_t idx =
static_cast<size_t>(index);
165 "Cannot mark the method as 'raw' because it has already "
166 "been marked as 'generic'.");
173 size_t idx =
static_cast<size_t>(index);
175 methods_[idx]->handler() !=
nullptr &&
176 "Cannot mark the method as 'generic' because it has already been "
177 "marked as 'async' or 'raw'.");
178 methods_[idx].reset();
184 size_t idx =
static_cast<size_t>(index);
186 "Cannot mark an async or generic method Streamed");
187 methods_[idx]->SetHandler(streamed_method);
199 size_t idx =
static_cast<size_t>(index);
201 methods_[idx].get() !=
nullptr &&
202 "Cannot mark the method as 'callback' because it has already been "
203 "marked as 'generic'.");
204 methods_[idx]->SetHandler(handler);
205 methods_[idx]->SetServerApiType(
212 size_t idx =
static_cast<size_t>(index);
214 methods_[idx].get() !=
nullptr &&
215 "Cannot mark the method as 'raw callback' because it has already "
216 "been marked as 'generic'.");
217 methods_[idx]->SetHandler(handler);
218 methods_[idx]->SetServerApiType(
223 size_t idx =
static_cast<size_t>(index);
224 return methods_[idx]->handler();
231 std::vector<std::unique_ptr<internal::RpcServiceMethod>> methods_;
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue.h:102
A specific type of completion queue used by the processing of notifications by servers.
Definition: completion_queue.h:429
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context.h:538
Represents a gRPC server.
Definition: server.h:59
Definition: server_interface.h:59
void RequestAsyncCall(internal::RpcServiceMethod *method, ::grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, ::grpc::CompletionQueue *call_cq, ::grpc::ServerCompletionQueue *notification_cq, void *tag, Message *message)
Definition: server_interface.h:314
Desriptor of an RPC service and its various RPC methods.
Definition: service_type.h:56
void MarkMethodGeneric(int index)
Definition: service_type.h:170
internal::MethodHandler * GetHandler(int index)
Definition: service_type.h:222
bool has_callback_methods() const
Definition: service_type.h:80
void RequestAsyncUnary(int index, ::grpc::ServerContext *context, Message *request, internal::ServerAsyncStreamingInterface *stream, ::grpc::CompletionQueue *call_cq, ::grpc::ServerCompletionQueue *notification_cq, void *tag)
Definition: service_type.h:103
void MarkMethodStreamed(int index, internal::MethodHandler *streamed_method)
Definition: service_type.h:181
void RequestAsyncClientStreaming(int index, ::grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, ::grpc::CompletionQueue *call_cq, ::grpc::ServerCompletionQueue *notification_cq, void *tag)
Definition: service_type.h:116
void MarkMethodRawCallback(int index, internal::MethodHandler *handler)
Definition: service_type.h:209
void MarkMethodCallback(int index, internal::MethodHandler *handler)
Definition: service_type.h:196
void RequestAsyncBidiStreaming(int index, ::grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, ::grpc::CompletionQueue *call_cq, ::grpc::ServerCompletionQueue *notification_cq, void *tag)
Definition: service_type.h:135
Service()
Definition: service_type.h:58
void MarkMethodRaw(int index)
Definition: service_type.h:160
bool has_generic_methods() const
Definition: service_type.h:92
void AddMethod(internal::RpcServiceMethod *method)
Definition: service_type.h:145
void RequestAsyncServerStreaming(int index, ::grpc::ServerContext *context, Message *request, internal::ServerAsyncStreamingInterface *stream, ::grpc::CompletionQueue *call_cq, ::grpc::ServerCompletionQueue *notification_cq, void *tag)
Definition: service_type.h:126
virtual ~Service()
Definition: service_type.h:59
bool has_synchronous_methods() const
Definition: service_type.h:70
void MarkMethodAsync(int index)
Definition: service_type.h:149
bool has_async_methods() const
Definition: service_type.h:61
Straightforward wrapping of the C call object.
Definition: call.h:35
Base class for running an RPC handler.
Definition: rpc_service_method.h:38
@ BIDI_STREAMING
Definition: rpc_method.h:35
Server side rpc method class.
Definition: rpc_service_method.h:84
Definition: service_type.h:37
virtual void SendInitialMetadata(void *tag)=0
Request notification of the sending of initial metadata to the client.
virtual ~ServerAsyncStreamingInterface()
Definition: service_type.h:39
#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:76
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33