19 #ifndef GRPCPP_IMPL_CODEGEN_CALLBACK_COMMON_H 20 #define GRPCPP_IMPL_CODEGEN_CALLBACK_COMMON_H 35 template <
class Func,
class... Args>
37 #if GRPC_ALLOW_EXCEPTIONS 39 func(std::forward<Args>(args)...);
43 #else // GRPC_ALLOW_EXCEPTIONS 44 func(std::forward<Args>(args)...);
45 #endif // GRPC_ALLOW_EXCEPTIONS 56 static void operator delete(
void* ptr, std::size_t size) {
65 static void operator delete(
void*,
void*) { assert(0); }
69 : call_(call), func_(
std::move(f)), ops_(ops) {
80 status_ = std::move(s);
86 std::function<void(Status)> func_;
104 auto func = std::move(func_);
105 auto status = std::move(status_);
120 static void operator delete(
void* ptr, std::size_t size) {
129 static void operator delete(
void*,
void*) { assert(0); }
149 func_ = std::move(f);
156 if (call_ !=
nullptr) {
172 operator bool()
const {
return call_ !=
nullptr; }
176 std::function<void(bool)> func_;
184 void* ignored = ops_;
200 #endif // GRPCPP_IMPL_CODEGEN_CALLBACK_COMMON_H
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:70
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:141
void force_run(bool ok)
Definition: callback_common.h:169
virtual void grpc_call_ref(grpc_call *call)=0
CallbackWithSuccessTag(grpc_call *call, std::function< void(bool)> f, CompletionQueueTag *ops)
Definition: callback_common.h:133
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:26
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:164
Definition: async_unary_call.h:304
::google::protobuf::util::Status Status
Definition: config_protobuf.h:93
void Set(grpc_call *call, std::function< void(bool)> f, CompletionQueueTag *ops)
Definition: callback_common.h:146
~CallbackWithSuccessTag()
Definition: callback_common.h:141
CallbackWithStatusTag(grpc_call *call, std::function< void(Status)> f, CompletionQueueTag *ops)
Definition: callback_common.h:67
Status * status_ptr()
Definition: callback_common.h:74
An Alarm posts the user provided tag to its associated completion queue upon expiry or cancellation...
Definition: alarm.h:33
void force_run(Status s)
Definition: callback_common.h:79
~CallbackWithStatusTag()
Definition: callback_common.h:73
CoreCodegenInterface * g_core_codegen_interface
Definition: call_op_set.h:50
CallbackWithSuccessTag can be reused multiple times, and will be used in this fashion for streaming o...
Definition: callback_common.h:116
Did it work? If it didn't, why?
Definition: status.h:31
void Clear()
Definition: callback_common.h:155
void CatchingCallback(Func &&func, Args &&... args)
An exception-safe way of invoking a user-specified callback function.
Definition: callback_common.h:36
Definition: callback_common.h:52
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:678
EXPERIMENTAL: Specifies an interface class to be used as a tag for callback-based completion queues...
Definition: grpc_types.h:673
CallbackWithSuccessTag()
Definition: callback_common.h:131