![]() |
Gaia-ECS v1.0.0
A simple and powerful entity component system
|
Paged implicit list declaration. More...
#include <ilist.h>
Public Types | |
| using | value_type = TListItem |
| Stored payload type. | |
| using | reference = TListItem & |
| Mutable payload reference. | |
| using | const_reference = const TListItem & |
| Immutable payload reference. | |
| using | pointer = TListItem * |
| Mutable payload pointer. | |
| using | const_pointer = const TListItem * |
| Immutable payload pointer. | |
| using | difference_type = std::ptrdiff_t |
| Type used for iterator distances. | |
| using | size_type = uint32_t |
| Type used for slot indices and sizes. | |
| using | iterator_category = core::forward_iterator_tag |
| Iterator category tag. | |
| using | iterator = paged_ilist_iterator< paged_ilist, false > |
| Mutable forward iterator over live payloads. | |
| using | const_iterator = paged_ilist_iterator< paged_ilist, true > |
| Immutable forward iterator over live payloads. | |
Public Member Functions | |
| paged_ilist (const paged_ilist &)=delete | |
| paged_ilist & | operator= (const paged_ilist &)=delete |
| paged_ilist (paged_ilist &&other) noexcept | |
| Move-constructs a paged list and leaves the source empty. | |
| paged_ilist & | operator= (paged_ilist &&other) noexcept |
| Move-assigns a paged list and leaves the source empty. | |
| GAIA_NODISCARD pointer | data () noexcept |
| Reports that paged storage is not globally contiguous. | |
| GAIA_NODISCARD const_pointer | data () const noexcept |
| Reports that paged storage is not globally contiguous. | |
| GAIA_NODISCARD bool | has (size_type index) const noexcept |
| Checks whether a slot contains a live payload. | |
| GAIA_NODISCARD bool | has (TItemHandle handle) const noexcept |
| Checks whether a handle identifies its current live payload. | |
| GAIA_NODISCARD TItemHandle | handle (size_type index) const noexcept |
| Returns the handle metadata stored for a slot. | |
| GAIA_NODISCARD uint32_t | generation (size_type index) const noexcept |
| Returns a slot's generation. | |
| GAIA_NODISCARD uint32_t | next_free (size_type index) const noexcept |
| Returns the free-list link stored for a slot. | |
| GAIA_NODISCARD reference | operator[] (size_type index) |
| Returns a live payload by slot index. | |
| GAIA_NODISCARD const_reference | operator[] (size_type index) const |
| Returns a live payload by slot index. | |
| void | clear () |
| Destroys all live payloads, releases all pages, and resets slot metadata. | |
| GAIA_NODISCARD size_type | get_next_free_item () const noexcept |
| Returns the free-list head. | |
| GAIA_NODISCARD size_type | get_free_items () const noexcept |
| Returns the number of recyclable slots. | |
| GAIA_NODISCARD size_type | item_count () const noexcept |
| Returns the number of live payloads. | |
| GAIA_NODISCARD size_type | size () const noexcept |
| Returns the total number of addressable slots in use. | |
| GAIA_NODISCARD bool | empty () const noexcept |
| Checks whether no slots are in use. | |
| GAIA_NODISCARD size_type | capacity () const noexcept |
| Returns the slot capacity represented by the page table. | |
| GAIA_NODISCARD iterator | begin () noexcept |
| Returns an iterator over live payload objects only. | |
| GAIA_NODISCARD const_iterator | begin () const noexcept |
| Returns an iterator over live payload objects only. | |
| GAIA_NODISCARD const_iterator | cbegin () const noexcept |
| Returns an iterator over live payload objects only. | |
| GAIA_NODISCARD iterator | end () noexcept |
| Returns the mutable end sentinel. | |
| GAIA_NODISCARD const_iterator | end () const noexcept |
| Returns the immutable end sentinel. | |
| GAIA_NODISCARD const_iterator | cend () const noexcept |
| Returns the immutable end sentinel. | |
| void | reserve (size_type cap) |
| Reserves page-table capacity for at least cap slots. | |
| void | reserve_slot_table (size_type cap) |
| Ensures the page pointer table can address cap slots without resizing later. | |
| GAIA_NODISCARD reference | live_unsafe (size_type index) |
| Returns a live payload slot without consulting list-wide size metadata. | |
| GAIA_NODISCARD const_reference | live_unsafe (size_type index) const |
| Returns a live payload slot without consulting list-wide size metadata. | |
| GAIA_NODISCARD reference | payload_unsafe (size_type index) |
| Returns a constructed payload slot without consulting shared liveness metadata. | |
| GAIA_NODISCARD const_reference | payload_unsafe (size_type index) const |
| Returns a constructed payload slot without consulting shared liveness metadata. | |
| GAIA_NODISCARD pointer | try_get (size_type index) noexcept |
| Attempts to access a live payload. | |
| GAIA_NODISCARD const_pointer | try_get (size_type index) const noexcept |
| Attempts to access a live payload. | |
| void | add_live (TListItem &&item) |
| Restores a live slot with a preassigned id/generation. | |
| void | add_free (TItemHandle handle, uint32_t nextFreeIdx) |
| Restores a free slot with a preassigned id/generation and free-list link. | |
| void | add_free (size_type index, uint32_t generation, uint32_t nextFreeIdx) |
| Restores a free slot with a preassigned id/generation and free-list link. | |
| GAIA_NODISCARD TItemHandle | alloc (void *ctx) |
| Allocates a new item in the list. | |
| GAIA_NODISCARD TItemHandle | alloc () |
| Allocates a new item in the list. | |
| void | free (TItemHandle handle) |
| Frees a live item and destroys its payload immediately. | |
| void | free_keep_live (TItemHandle handle) |
| Frees a handle while keeping the payload alive until slot reuse or clear(). | |
| void | validate () const |
| Verifies that the implicit free-list links are well formed. | |
Static Public Member Functions | |
| static GAIA_NODISCARD constexpr size_type | page_capacity () noexcept |
| Returns the compile-time number of payload slots stored in one page. | |
| static GAIA_NODISCARD constexpr size_type | page_count_for_capacity (size_type slotCnt) noexcept |
| Calculates how many pages are needed to address slotCnt slots. | |
Public Attributes | |
| size_type | m_nextFreeIdx = (size_type)-1 |
| Head of the implicit free-list, or TItemHandle::IdMask when no slots are free. | |
| size_type | m_freeItems = 0 |
| Number of slots currently linked through the implicit free-list. | |
Paged implicit list declaration.
Paged implicit list with page-local slot metadata and lazily allocated page payloads. Live slots own payload objects. Dead slots keep only handle and free-list metadata, which allows payload storage for fully empty pages to be released.
| TListItem | Payload type stored in the list. |
| TItemHandle | External handle type used to address slots. |
| MaxPages | Maximum number of addressable pages. A value of 0 keeps the page table dynamic. A non-zero value embeds a fixed page table in the container so page-table storage never reallocates after construction. |
| TListItem | Payload type stored in the list. Must expose slot metadata through ilist_item_traits<TListItem> and ilist-compatible create()/handle() helpers. |
| TItemHandle | External handle type exposing id(), gen(), and IdMask. |
| MaxPages | Maximum number of page pointers kept by the container. Use 0 for dynamic growth through darray. Use a non-zero value when the maximum slot count is known and pointer-table relocation must be impossible. |
|
inlinenoexcept |
Move-constructs a paged list and leaves the source empty.
| other | Paged list whose pages are transferred. |
|
inline |
Restores a free slot with a preassigned id/generation and free-list link.
| index | Slot index to restore. |
| generation | Generation to store in the restored handle. |
| nextFreeIdx | Next slot in the implicit free-list, or TItemHandle::IdMask. |
|
inline |
Restores a free slot with a preassigned id/generation and free-list link.
| handle | Handle metadata to restore for the free slot. |
| nextFreeIdx | Next slot in the implicit free-list, or TItemHandle::IdMask. |
|
inline |
Restores a live slot with a preassigned id/generation.
| item | Payload carrying the slot index and generation to restore. |
|
inline |
Allocates a new item in the list.
|
inline |
Allocates a new item in the list.
| ctx | Creation context forwarded to TListItem::create(). |
|
inlinenoexcept |
Returns an iterator over live payload objects only.
|
inlinenoexcept |
Returns an iterator over live payload objects only.
|
inlinenoexcept |
Returns the slot capacity represented by the page table.
|
inlinenoexcept |
Returns an iterator over live payload objects only.
|
inlinenoexcept |
Returns the immutable end sentinel.
|
inlinenoexcept |
Reports that paged storage is not globally contiguous.
|
inlinenoexcept |
Reports that paged storage is not globally contiguous.
|
inlinenoexcept |
Checks whether no slots are in use.
|
inlinenoexcept |
Returns the immutable end sentinel.
|
inlinenoexcept |
Returns the mutable end sentinel.
|
inline |
Frees a live item and destroys its payload immediately.
| handle | Handle identifying the item to release. |
|
inline |
Frees a handle while keeping the payload alive until slot reuse or clear().
| handle | Handle identifying the item to release. |
|
inlinenoexcept |
Returns a slot's generation.
| index | Valid slot index. |
|
inlinenoexcept |
Returns the number of recyclable slots.
|
inlinenoexcept |
Returns the free-list head.
|
inlinenoexcept |
Returns the handle metadata stored for a slot.
| index | Valid slot index. |
|
inlinenoexcept |
Checks whether a slot contains a live payload.
| index | Slot index to inspect. |
|
inlinenoexcept |
Checks whether a handle identifies its current live payload.
| handle | Handle to validate. |
|
inlinenoexcept |
Returns the number of live payloads.
|
inline |
Returns a live payload slot without consulting list-wide size metadata.
| index | Slot index to access. |
|
inline |
Returns a live payload slot without consulting list-wide size metadata.
| index | Slot index to access. |
|
inlinenoexcept |
Returns the free-list link stored for a slot.
| index | Valid slot index. |
|
inlinenoexcept |
Move-assigns a paged list and leaves the source empty.
| other | Paged list whose pages are transferred. |
|
inline |
Returns a live payload by slot index.
| index | Live slot index. |
|
inline |
Returns a live payload by slot index.
| index | Live slot index. |
|
inlinestaticconstexprnoexcept |
Returns the compile-time number of payload slots stored in one page.
|
inlinestaticconstexprnoexcept |
Calculates how many pages are needed to address slotCnt slots.
| slotCnt | Number of slots that must be addressable. |
|
inline |
Returns a constructed payload slot without consulting shared liveness metadata.
| index | Slot index to access. |
|
inline |
Returns a constructed payload slot without consulting shared liveness metadata.
| index | Slot index to access. |
|
inline |
Reserves page-table capacity for at least cap slots.
| cap | Number of slots that should be addressable without growing the page table. |
|
inline |
Ensures the page pointer table can address cap slots without resizing later.
| cap | Number of slots that must be addressable. |
|
inlinenoexcept |
Returns the total number of addressable slots in use.
|
inlinenoexcept |
Attempts to access a live payload.
| index | Slot index to inspect. |
|
inlinenoexcept |
Attempts to access a live payload.
| index | Slot index to inspect. |