|
VoltMod
C++23 framework for CS2 server plugins
|
Owns one registration and releases it on destruction. More...
#include <Subscription.hpp>
Public Member Functions | |
| Subscription ()=default | |
| Subscription (std::move_only_function< void()> cleanup) | |
| ~Subscription () | |
| Subscription (Subscription &&other) noexcept | |
| Subscription & | operator= (Subscription &&other) noexcept |
| Subscription (const Subscription &)=delete | |
| Subscription & | operator= (const Subscription &)=delete |
| void | Reset () |
| operator bool () const noexcept | |
Owns one registration and releases it on destruction.
Holding one keeps the registration alive. Store it beside the state captured by its handler so it unregisters before that state is destroyed:
The cleanup callable may hold any registry handle, including non-handle-based registrations such as hook installs (see VoltMod::HookInterface).
Move-only. The registry must outlive its Subscription; reverse declaration order provides this when both are members of one object.
<VoltMod/Core/Signals/Subscriptions.hpp> holds several of them in one member, for an object that subscribes to a handful of things at once.
Definition at line 33 of file Subscription.hpp.
|
default |
|
inlineexplicit |
Run cleanup on destruction; it captures whatever handle the registry issued.
Definition at line 39 of file Subscription.hpp.
|
inline |
Definition at line 41 of file Subscription.hpp.
References Reset().
|
inlinenoexcept |
Definition at line 43 of file Subscription.hpp.
|
delete |
|
inlineexplicitnoexcept |
True while this holds a live registration.
Definition at line 68 of file Subscription.hpp.
|
delete |
|
inlinenoexcept |
Definition at line 45 of file Subscription.hpp.
References VoltMod::ReadFile(), and Reset().
|
inline |
Release now. Idempotent, and re-entrant: the callable is detached before it runs.
Definition at line 59 of file Subscription.hpp.
References VoltMod::ReadFile().
Referenced by VoltMod::Database::Disconnect(), operator=(), VoltMod::ScreenManager::ScreenManager(), VoltMod::PerSlot< T >::~PerSlot(), and ~Subscription().