19 #ifndef GRPCPP_IMPL_CODEGEN_CALLBACK_COMMON_H 20 #define GRPCPP_IMPL_CODEGEN_CALLBACK_COMMON_H 37 template <
class Func,
class... Args>
39 #if GRPC_ALLOW_EXCEPTIONS 41 func(std::forward<Args>(args)...);
45 #else // GRPC_ALLOW_EXCEPTIONS 46 func(std::forward<Args>(args)...);
47 #endif // GRPC_ALLOW_EXCEPTIONS 50 template <
class Reactor,
class Func,
class... Args>
52 #if GRPC_ALLOW_EXCEPTIONS 54 return func(std::forward<Args>(args)...);
59 #else // GRPC_ALLOW_EXCEPTIONS 60 return func(std::forward<Args>(args)...);
61 #endif // GRPC_ALLOW_EXCEPTIONS 72 static void operator delete(
void* , std::size_t size) {
85 : call_(call), func_(
std::move(f)), ops_(ops) {
100 status_ = std::move(s);
106 std::function<void(Status)> func_;
115 void* ignored = ops_;
124 auto func = std::move(func_);
125 auto status = std::move(status_);
140 static void operator delete(
void* , std::size_t size) {
155 Set(call, f,
ops, can_inline);
174 func_ = std::move(f);
181 if (call_ !=
nullptr) {
197 operator bool()
const {
return call_ !=
nullptr; }
201 std::function<void(bool)> func_;
209 void* ignored = ops_;
227 #endif // GRPCPP_IMPL_CODEGEN_CALLBACK_COMMON_H
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:70
CoreCodegenInterface * g_core_codegen_interface
Null-initializes the global gRPC variables for the codegen library.
Definition: completion_queue_impl.h:90
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:146
void force_run(bool ok)
Definition: callback_common.h:194
virtual void grpc_call_ref(grpc_call *call)=0
int inlineable
The inlineable member specifies whether this functor can be run inline.
Definition: grpc_types.h:731
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:26
Reactor * CatchingReactorGetter(Func &&func, Args &&... args)
Definition: callback_common.h:51
virtual bool FinalizeResult(void **tag, bool *status)=0
FinalizeResult must be called before informing user code that the operation bound to the underlying c...
virtual void grpc_call_unref(grpc_call *call)=0
CompletionQueueTag * ops()
Definition: callback_common.h:189
Definition: async_unary_call_impl.h:301
::google::protobuf::util::Status Status
Definition: config_protobuf.h:90
void Set(grpc_call *call, std::function< void(bool)> f, CompletionQueueTag *ops, bool can_inline)
Definition: callback_common.h:169
~CallbackWithSuccessTag()
Definition: callback_common.h:161
CallbackWithSuccessTag(grpc_call *call, std::function< void(bool)> f, CompletionQueueTag *ops, bool can_inline)
Definition: callback_common.h:153
CallbackWithStatusTag(grpc_call *call, std::function< void(Status)> f, CompletionQueueTag *ops)
Definition: callback_common.h:83
Status * status_ptr()
Definition: callback_common.h:94
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
void force_run(Status s)
Definition: callback_common.h:99
~CallbackWithStatusTag()
Definition: callback_common.h:93
CallbackWithSuccessTag & operator=(const CallbackWithSuccessTag &)=delete
CallbackWithSuccessTag can be reused multiple times, and will be used in this fashion for streaming o...
Definition: callback_common.h:136
Did it work? If it didn't, why?
Definition: status.h:31
void Clear()
Definition: callback_common.h:180
void CatchingCallback(Func &&func, Args &&... args)
An exception-safe way of invoking a user-specified callback function.
Definition: callback_common.h:38
Definition: callback_common.h:68
void(* functor_run)(struct grpc_experimental_completion_queue_functor *, int)
The run member specifies a function that will be called when this tag is extracted from the completio...
Definition: grpc_types.h:727
EXPERIMENTAL: Specifies an interface class to be used as a tag for callback-based completion queues...
Definition: grpc_types.h:722
#define GPR_CODEGEN_DEBUG_ASSERT(x)
Codegen specific version of GPR_DEBUG_ASSERT.
Definition: core_codegen_interface.h:155
CallbackWithSuccessTag()
Definition: callback_common.h:151