diff options
author | Sergey Polovko <sergey@polovko.me> | 2022-02-10 16:47:03 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:03 +0300 |
commit | 2e714b5ebd40a1f4cc31c27f1ad6e49ca6d895f5 (patch) | |
tree | b83306b6e37edeea782e9eed673d89286c4fef35 /library/cpp/grpc/server/event_callback.h | |
parent | 3e0b762a82514bac89c1dd6ea7211e381d8aa248 (diff) | |
download | ydb-2e714b5ebd40a1f4cc31c27f1ad6e49ca6d895f5.tar.gz |
Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/grpc/server/event_callback.h')
-rw-r--r-- | library/cpp/grpc/server/event_callback.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/library/cpp/grpc/server/event_callback.h b/library/cpp/grpc/server/event_callback.h index 13d9bb46b2..d0b700b3c9 100644 --- a/library/cpp/grpc/server/event_callback.h +++ b/library/cpp/grpc/server/event_callback.h @@ -2,7 +2,7 @@ #include "grpc_server.h" -namespace NGrpc { +namespace NGrpc { enum class EQueueEventStatus { OK, @@ -10,7 +10,7 @@ enum class EQueueEventStatus { }; template<class TCallback> -class TQueueEventCallback: public IQueueEvent { +class TQueueEventCallback: public IQueueEvent { public: TQueueEventCallback(const TCallback& callback) : Callback(callback) @@ -33,9 +33,9 @@ private: TCallback Callback; }; -// Implementation of IQueueEvent that reduces allocations +// Implementation of IQueueEvent that reduces allocations template<class TSelf> -class TQueueFixedEvent: private IQueueEvent { +class TQueueFixedEvent: private IQueueEvent { using TCallback = void (TSelf::*)(EQueueEventStatus); public: @@ -44,7 +44,7 @@ public: , Callback(callback) { } - IQueueEvent* Prepare() { + IQueueEvent* Prepare() { Self->Ref(); return this; } @@ -65,16 +65,16 @@ private: }; template<class TCallback> -inline IQueueEvent* MakeQueueEventCallback(TCallback&& callback) { +inline IQueueEvent* MakeQueueEventCallback(TCallback&& callback) { return new TQueueEventCallback<TCallback>(std::forward<TCallback>(callback)); } template<class T> -inline IQueueEvent* MakeQueueEventCallback(T* self, void (T::*method)(EQueueEventStatus)) { +inline IQueueEvent* MakeQueueEventCallback(T* self, void (T::*method)(EQueueEventStatus)) { using TPtr = TIntrusivePtr<T>; return MakeQueueEventCallback([self = TPtr(self), method] (EQueueEventStatus status) { ((*self).*method)(status); }); } -} // namespace NGrpc +} // namespace NGrpc |