|
libxr
Embedded C++ framework for bare-metal, RTOS and Linux
|
只读句柄:共享一个槽位,可以复制。 Read-only handle: shares one slot, copyable. More...
#include <object_pool.hpp>
Public Member Functions | |
| ConstHandle ()=default | |
| 构造空句柄 / Construct an empty handle. | |
| ConstHandle (const ConstHandle &other) noexcept | |
| 复制引用 / Copy the reference. | |
| ConstHandle (ConstHandle &&other) noexcept | |
| 转移引用并清空源句柄 / Transfer the reference and empty the source. | |
| ConstHandle (Handle &&writer) noexcept | |
| 接过可写句柄的槽位,源句柄变空 / Take over a writable handle's slot; the source becomes empty. | |
| ConstHandle & | operator= (const ConstHandle &other) noexcept |
| 复制赋值:先保留新引用再释放旧引用 / Copy-assign: retain the new reference before releasing the old one. | |
| ConstHandle & | operator= (ConstHandle &&other) noexcept |
| 转移赋值并释放旧引用 / Move-assign and release the old reference. | |
| ConstHandle & | operator= (Handle &&writer) noexcept |
| 接过可写句柄的槽位并释放旧引用 / Take over a writable handle's slot and release the old reference. | |
| ~ConstHandle () | |
| 释放本引用;最后一个引用归还槽位 / Release; the final reference returns the slot. | |
| bool | Valid () const |
| 是否持有引用 / Whether this handle owns a reference. | |
| const Data & | Get () const |
| 只读访问负载,句柄必须有效 / Read-only payload access; requires a valid handle. | |
| const Data * | operator-> () const |
| 返回只读负载指针 / Return a read-only payload pointer. | |
| const Data & | operator* () const |
| 只读解引用 / Dereference read-only. | |
| IndexType | Index () const |
| 返回有效句柄的槽索引 / Return the slot index of a valid handle. | |
| void | Reset () |
| 清空句柄并释放引用;空句柄无操作 / Empty and release; no-op on an empty handle. | |
只读句柄:共享一个槽位,可以复制。 Read-only handle: shares one slot, copyable.
只能由 Handle 移动得到或由其他 ConstHandle 复制得到;复制增加引用,最后一个 引用释放时槽位回到池中。 Obtained only by moving a Handle or copying another ConstHandle. Copies add references; the final release returns the slot to the pool.
Definition at line 199 of file object_pool.hpp.
|
inlinenoexcept |
复制引用 / Copy the reference.
Definition at line 206 of file object_pool.hpp.
|
inlinenoexcept |
转移引用并清空源句柄 / Transfer the reference and empty the source.
Definition at line 216 of file object_pool.hpp.
|
inlinenoexcept |
接过可写句柄的槽位,源句柄变空 / Take over a writable handle's slot; the source becomes empty.
Definition at line 224 of file object_pool.hpp.
|
inline |
释放本引用;最后一个引用归还槽位 / Release; the final reference returns the slot.
Definition at line 264 of file object_pool.hpp.
|
inlinenodiscard |
只读访问负载,句柄必须有效 / Read-only payload access; requires a valid handle.
Definition at line 271 of file object_pool.hpp.
|
inlinenodiscard |
返回有效句柄的槽索引 / Return the slot index of a valid handle.
Definition at line 283 of file object_pool.hpp.
|
inlinenodiscard |
只读解引用 / Dereference read-only.
Definition at line 280 of file object_pool.hpp.
|
inlinenodiscard |
|
inlinenoexcept |
复制赋值:先保留新引用再释放旧引用 / Copy-assign: retain the new reference before releasing the old one.
Definition at line 232 of file object_pool.hpp.
|
inlinenoexcept |
转移赋值并释放旧引用 / Move-assign and release the old reference.
Definition at line 243 of file object_pool.hpp.
|
inlinenoexcept |
接过可写句柄的槽位并释放旧引用 / Take over a writable handle's slot and release the old reference.
Definition at line 255 of file object_pool.hpp.
|
inline |
清空句柄并释放引用;空句柄无操作 / Empty and release; no-op on an empty handle.
Definition at line 291 of file object_pool.hpp.
|
inlinenodiscard |
是否持有引用 / Whether this handle owns a reference.
Definition at line 267 of file object_pool.hpp.