|
libxr
Embedded C++ framework for bare-metal, RTOS and Linux
|
可写句柄:独占一个槽位,只能移动。 Writable handle: exclusive owner of one slot, move-only. More...
#include <object_pool.hpp>
Public Member Functions | |
| Handle ()=default | |
| 构造空句柄 / Construct an empty handle. | |
| Handle (const Handle &)=delete | |
| 禁止拷贝构造 / Non-copyable. | |
| Handle & | operator= (const Handle &)=delete |
| 禁止拷贝赋值 / Non-copy-assignable. | |
| Handle (Handle &&other) noexcept | |
| 转移槽位并清空源句柄 / Transfer the slot and empty the source. | |
| Handle & | operator= (Handle &&other) noexcept |
| 转移槽位并释放原有槽位 / Transfer the slot and release the previous one. | |
| ~Handle () | |
| 释放槽位 / Release the slot. | |
| bool | Valid () const |
| 是否持有槽位 / Whether this handle owns a slot. | |
| Data & | Get () |
| 访问负载,句柄必须有效 / Access the payload; requires a valid handle. | |
| const Data & | Get () const |
| 只读访问负载,句柄必须有效 / Read-only payload access; requires a valid handle. | |
| Data * | operator-> () |
| 返回负载指针 / Return the payload pointer. | |
| const Data * | operator-> () const |
| 返回只读负载指针 / Return a read-only payload pointer. | |
| Data & | operator* () |
| 解引用 / Dereference. | |
| 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. | |
Friends | |
| class | ObjectPool |
| class | ConstHandle |
可写句柄:独占一个槽位,只能移动。 Writable handle: exclusive owner of one slot, move-only.
Acquire 得到可写句柄;写完后移动为 ConstHandle 共享出去。 Acquire yields a writable handle; after writing, move it into a ConstHandle to share the slot.
Definition at line 100 of file object_pool.hpp.
|
inlinenoexcept |
转移槽位并清空源句柄 / Transfer the slot and empty the source.
Definition at line 112 of file object_pool.hpp.
|
inline |
释放槽位 / Release the slot.
Definition at line 131 of file object_pool.hpp.
|
inlinenodiscard |
访问负载,句柄必须有效 / Access the payload; requires a valid handle.
Definition at line 137 of file object_pool.hpp.
|
inlinenodiscard |
只读访问负载,句柄必须有效 / Read-only payload access; requires a valid handle.
Definition at line 145 of file object_pool.hpp.
|
inlinenodiscard |
返回有效句柄的槽索引 / Return the slot index of a valid handle.
Definition at line 161 of file object_pool.hpp.
|
inlinenodiscard |
解引用 / Dereference.
Definition at line 156 of file object_pool.hpp.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenoexcept |
转移槽位并释放原有槽位 / Transfer the slot and release the previous one.
Definition at line 119 of file object_pool.hpp.
|
inline |
清空句柄并释放槽位;空句柄无操作 / Empty and release; no-op on an empty handle.
Definition at line 169 of file object_pool.hpp.
|
inlinenodiscard |
是否持有槽位 / Whether this handle owns a slot.
Definition at line 134 of file object_pool.hpp.
|
friend |
Definition at line 181 of file object_pool.hpp.
|
friend |
Definition at line 180 of file object_pool.hpp.