Go to the documentation of this file.
19 #ifndef GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H
20 #define GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H
33 class CompletionQueue;
35 class ServerInterface;
53 virtual void BindCall(
Call* call) = 0;
64 for (
const auto& method : methods_) {
65 if (method && method->handler() ==
nullptr) {
73 for (
const auto& method : methods_) {
83 for (
const auto& method : methods_) {
84 if (method && (method->api_type() ==
95 for (
const auto& method : methods_) {
96 if (method ==
nullptr) {
104 template <
class Message>
114 size_t idx =
static_cast<size_t>(index);
116 notification_cq, tag, request);
123 size_t idx =
static_cast<size_t>(index);
125 notification_cq, tag);
127 template <
class Message>
133 size_t idx =
static_cast<size_t>(index);
135 notification_cq, tag, request);
142 size_t idx =
static_cast<size_t>(index);
144 notification_cq, tag);
148 methods_.emplace_back(method);
154 size_t idx =
static_cast<size_t>(index);
156 methods_[idx].get() !=
nullptr &&
157 "Cannot mark the method as 'async' because it has already been "
158 "marked as 'generic'.");
165 size_t idx =
static_cast<size_t>(index);
167 "Cannot mark the method as 'raw' because it has already "
168 "been marked as 'generic'.");
175 size_t idx =
static_cast<size_t>(index);
177 methods_[idx]->handler() !=
nullptr &&
178 "Cannot mark the method as 'generic' because it has already been "
179 "marked as 'async' or 'raw'.");
180 methods_[idx].reset();
186 size_t idx =
static_cast<size_t>(index);
188 "Cannot mark an async or generic method Streamed");
189 methods_[idx]->SetHandler(streamed_method);
201 size_t idx =
static_cast<size_t>(index);
203 methods_[idx].get() !=
nullptr &&
204 "Cannot mark the method as 'callback' because it has already been "
205 "marked as 'generic'.");
206 methods_[idx]->SetHandler(handler);
207 methods_[idx]->SetServerApiType(
214 size_t idx =
static_cast<size_t>(index);
216 methods_[idx].get() !=
nullptr &&
217 "Cannot mark the method as 'raw callback' because it has already "
218 "been marked as 'generic'.");
219 methods_[idx]->SetHandler(handler);
220 methods_[idx]->SetServerApiType(
225 size_t idx =
static_cast<size_t>(index);
226 return methods_[idx]->handler();
233 std::vector<std::unique_ptr<internal::RpcServiceMethod>> methods_;
238 #endif // GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H
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:105
bool has_callback_methods() const
Definition: service_type.h:82
Definition: service_type.h:39
void MarkMethodRaw(int index)
Definition: service_type.h:162
void MarkMethodAsync(int index)
Definition: service_type.h:151
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context.h:566
Represents a gRPC server.
Definition: server.h:59
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
virtual ~Service()
Definition: service_type.h:61
internal::MethodHandler * GetHandler(int index)
Definition: service_type.h:224
bool has_generic_methods() const
Definition: service_type.h:94
void RequestAsyncBidiStreaming(int index, grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag)
Definition: service_type.h:137
Straightforward wrapping of the C call object.
Definition: call.h:36
Desriptor of an RPC service and its various RPC methods.
Definition: service_type.h:58
void MarkMethodCallback(int index, internal::MethodHandler *handler)
Definition: service_type.h:198
@ BIDI_STREAMING
Definition: rpc_method.h:37
void MarkMethodGeneric(int index)
Definition: service_type.h:172
void AddMethod(internal::RpcServiceMethod *method)
Definition: service_type.h:147
bool has_synchronous_methods() const
Definition: service_type.h:72
void MarkMethodStreamed(int index, internal::MethodHandler *streamed_method)
Definition: service_type.h:183
virtual void SendInitialMetadata(void *tag)=0
Request notification of the sending of initial metadata to the client.
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:128
Base class for running an RPC handler.
Definition: rpc_service_method.h:40
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:315
A specific type of completion queue used by the processing of notifications by servers.
Definition: completion_queue.h:436
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue.h:104
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:151
Server side rpc method class.
Definition: rpc_service_method.h:86
bool has_async_methods() const
Definition: service_type.h:63
void MarkMethodRawCallback(int index, internal::MethodHandler *handler)
Definition: service_type.h:211
Definition: server_interface.h:61
::google::protobuf::Message Message
Definition: config_protobuf.h:78
void RequestAsyncClientStreaming(int index, grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag)
Definition: service_type.h:118
virtual ~ServerAsyncStreamingInterface()
Definition: service_type.h:41
Service()
Definition: service_type.h:60