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 ReturnType,
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* ptr, std::size_t size) {
81 static void operator delete(
void*,
void*) { assert(0); }
85 : call_(call), func_(
std::move(f)), ops_(ops) {
96 status_ = std::move(s);
102 std::function<void(Status)> func_;
111 void* ignored = ops_;
120 auto func = std::move(func_);
121 auto status = std::move(status_);
136 static void operator delete(
void* ptr, std::size_t size) {
145 static void operator delete(
void*,
void*) { assert(0); }
167 func_ = std::move(f);
173 if (call_ !=
nullptr) {
189 operator bool()
const {
return call_ !=
nullptr; }
193 std::function<void(bool)> func_;
201 void* ignored = ops_;
219 #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:145
void force_run(bool ok)
Definition: callback_common.h:186
virtual void grpc_call_ref(grpc_call *call)=0
CallbackWithSuccessTag(grpc_call *call, std::function< void(bool)> f, CompletionQueueTag *ops)
Definition: callback_common.h:149
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:181
Definition: async_unary_call_impl.h:302
::google::protobuf::util::Status Status
Definition: config_protobuf.h:96
void Set(grpc_call *call, std::function< void(bool)> f, CompletionQueueTag *ops)
Definition: callback_common.h:162
~CallbackWithSuccessTag()
Definition: callback_common.h:157
CallbackWithStatusTag(grpc_call *call, std::function< void(Status)> f, CompletionQueueTag *ops)
Definition: callback_common.h:83
Status * status_ptr()
Definition: callback_common.h:90
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:95
~CallbackWithStatusTag()
Definition: callback_common.h:89
CoreCodegenInterface * g_core_codegen_interface
Definition: completion_queue_impl.h:91
ReturnType * CatchingReactorCreator(Func &&func, Args &&... args)
Definition: callback_common.h:51
CallbackWithSuccessTag can be reused multiple times, and will be used in this fashion for streaming o...
Definition: callback_common.h:132
Did it work? If it didn't, why?
Definition: status.h:31
void Clear()
Definition: callback_common.h:172
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:711
EXPERIMENTAL: Specifies an interface class to be used as a tag for callback-based completion queues...
Definition: grpc_types.h:706
#define GPR_CODEGEN_DEBUG_ASSERT(x)
Codegen specific version of GPR_DEBUG_ASSERT.
Definition: core_codegen_interface.h:154
CallbackWithSuccessTag()
Definition: callback_common.h:147