Move-only RAII token that owns one observer registration. 更多...
#include <Subscription.h>
Public 类型 | |
| using | Cancel = std::function< void()> |
Public 成员函数 | |
| Subscription () noexcept=default | |
| Creates an inactive token. | |
| Subscription (Cancel cancel) | |
| Creates a token from a cancellation callback. | |
| Subscription (const Subscription &)=delete | |
| Subscription & | operator= (const Subscription &)=delete |
| Subscription (Subscription &&other) noexcept | |
| Subscription. | |
| Subscription & | operator= (Subscription &&other) noexcept |
| Operator =. | |
| ~Subscription () | |
| Subscription. | |
| void | dispose () noexcept |
| Cancels this registration; safe to call repeatedly. | |
| bool | disposed () const noexcept |
| Returns whether this token is inactive or has already been disposed. | |
| bool | isDisposed () const noexcept |
| Compatibility spelling for disposed(). | |
详细描述
Move-only RAII token that owns one observer registration.
Destroying or explicitly disposing the token cancels the registration. The cancellation operation is idempotent, and a moved-from token is inactive. The cancellation callback must be non-throwing; dispose() is noexcept and is therefore suitable for destructor use.
A token belongs to the thread-affine observer that created it. It must be disposed or destroyed on that observer's owner thread unless the observer explicitly documents a stronger cross-thread guarantee.
在文件 Subscription.h 第 27 行定义.
成员类型定义说明
◆ Cancel
| using eve::Subscription::Cancel = std::function<void()> |
在文件 Subscription.h 第 29 行定义.
构造及析构函数说明
◆ Subscription() [1/4]
|
defaultnoexcept |
Creates an inactive token.
◆ Subscription() [2/4]
|
explicit |
Creates a token from a cancellation callback.
- 参数
-
cancel Non-throwing callback invoked at most once on disposal.
在文件 Subscription.cpp 第 7 行定义.
◆ Subscription() [3/4]
|
delete |
◆ Subscription() [4/4]
|
noexcept |
在文件 Subscription.cpp 第 9 行定义.
◆ ~Subscription()
| eve::Subscription::~Subscription | ( | ) |
成员函数说明
◆ dispose()
|
noexcept |
Cancels this registration; safe to call repeatedly.
在文件 Subscription.cpp 第 25 行定义.
被这些函数引用 eve::ui::PropertyComponent::bind() , 以及 ~Subscription().
◆ disposed()
|
inlinenoexcept |
Returns whether this token is inactive or has already been disposed.
在文件 Subscription.h 第 53 行定义.
◆ isDisposed()
|
inlinenoexcept |
Compatibility spelling for disposed().
在文件 Subscription.h 第 56 行定义.
◆ operator=() [1/2]
|
delete |
◆ operator=() [2/2]
|
noexcept |
Operator =.
在文件 Subscription.cpp 第 14 行定义.
该类的文档由以下文件生成:
- src/engine/common/Subscription.h
- src/engine/common/Subscription.cpp