Go to the documentation of this file.
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_;
112 static_cast<CallbackWithStatusTag*>(cb)->Run(static_cast<bool>(ok));
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) {
169 func_ = std::move(f);
176 if (call_ !=
nullptr) {
192 operator bool()
const {
return call_ !=
nullptr; }
196 std::function<void(
bool)> func_;
201 static_cast<CallbackWithSuccessTag*>(cb)->Run(static_cast<bool>(ok));
204 void* ignored = ops_;
222 #endif // GRPCPP_IMPL_CODEGEN_CALLBACK_COMMON_H
CallbackWithSuccessTag can be reused multiple times, and will be used in this fashion for streaming o...
Definition: callback_common.h:136
~CallbackWithSuccessTag()
Definition: callback_common.h:156
int inlineable
The inlineable member specifies whether this functor can be run inline.
Definition: grpc_types.h:748
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
virtual void grpc_call_ref(grpc_call *call)=0
Status * status_ptr()
Definition: callback_common.h:94
Definition: callback_common.h:68
CallbackWithStatusTag(grpc_call *call, std::function< void(Status)> f, CompletionQueueTag *ops)
Definition: callback_common.h:83
Did it work? If it didn't, why?
Definition: status.h:31
CallbackWithSuccessTag & operator=(const CallbackWithSuccessTag &)=delete
EXPERIMENTAL: Specifies an interface class to be used as a tag for callback-based completion queues.
Definition: grpc_types.h:739
void force_run(bool ok)
Definition: callback_common.h:189
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:70
void force_run(Status s)
Definition: callback_common.h:99
void Clear()
Definition: callback_common.h:175
::google::protobuf::util::Status Status
Definition: config_protobuf.h:90
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:26
virtual void grpc_call_unref(grpc_call *call)=0
void Set(grpc_call *call, std::function< void(bool)> f, CompletionQueueTag *ops, bool can_inline)
Definition: callback_common.h:164
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:744
void CatchingCallback(Func &&func, Args &&... args)
An exception-safe way of invoking a user-specified callback function.
Definition: callback_common.h:38
CallbackWithSuccessTag()
Definition: callback_common.h:151
Definition: async_unary_call_impl.h:301
virtual bool FinalizeResult(void **tag, bool *status)=0
FinalizeResult must be called before informing user code that the operation bound to the underlying c...
CoreCodegenInterface * g_core_codegen_interface
Definition: completion_queue_impl.h:93
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:146
Reactor * CatchingReactorGetter(Func &&func, Args &&... args)
Definition: callback_common.h:51
CompletionQueueTag * ops()
Definition: callback_common.h:184
~CallbackWithStatusTag()
Definition: callback_common.h:93
#define GPR_CODEGEN_DEBUG_ASSERT(x)
Codegen specific version of GPR_DEBUG_ASSERT.
Definition: core_codegen_interface.h:155