![]() |
Gaia-ECS v0.9.3
A simple and powerful entity component system
|
Paged implicit list declaration. More...
#include <ilist.h>
Public Types | |
| using | value_type = TListItem |
| using | reference = TListItem & |
| using | const_reference = const TListItem & |
| using | pointer = TListItem * |
| using | const_pointer = const TListItem * |
| using | difference_type = std::ptrdiff_t |
| using | size_type = uint32_t |
| using | iterator_category = core::forward_iterator_tag |
| using | iterator = paged_ilist_iterator< paged_ilist, false > |
| using | const_iterator = paged_ilist_iterator< paged_ilist, true > |
Public Member Functions | |
| paged_ilist (const paged_ilist &)=delete | |
| paged_ilist & | operator= (const paged_ilist &)=delete |
| paged_ilist (paged_ilist &&other) noexcept | |
| paged_ilist & | operator= (paged_ilist &&other) noexcept |
| GAIA_NODISCARD pointer | data () noexcept |
| GAIA_NODISCARD const_pointer | data () const noexcept |
| GAIA_NODISCARD bool | has (size_type index) const noexcept |
| GAIA_NODISCARD bool | has (TItemHandle handle) const noexcept |
| GAIA_NODISCARD TItemHandle | handle (size_type index) const noexcept |
| GAIA_NODISCARD uint32_t | generation (size_type index) const noexcept |
| GAIA_NODISCARD uint32_t | next_free (size_type index) const noexcept |
| GAIA_NODISCARD reference | operator[] (size_type index) |
| GAIA_NODISCARD const_reference | operator[] (size_type index) const |
| void | clear () |
| GAIA_NODISCARD size_type | get_next_free_item () const noexcept |
| GAIA_NODISCARD size_type | get_free_items () const noexcept |
| GAIA_NODISCARD size_type | item_count () const noexcept |
| GAIA_NODISCARD size_type | size () const noexcept |
| GAIA_NODISCARD bool | empty () const noexcept |
| GAIA_NODISCARD size_type | capacity () const noexcept |
| GAIA_NODISCARD iterator | begin () noexcept |
| Returns an iterator over live payload objects only. | |
| GAIA_NODISCARD const_iterator | begin () const noexcept |
| GAIA_NODISCARD const_iterator | cbegin () const noexcept |
| GAIA_NODISCARD iterator | end () noexcept |
| GAIA_NODISCARD const_iterator | end () const noexcept |
| GAIA_NODISCARD const_iterator | cend () const noexcept |
| 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 pointer | try_get (size_type index) noexcept |
| GAIA_NODISCARD const_pointer | try_get (size_type index) const noexcept |
| 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. | |
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. |
|
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(). |
|
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. |
|
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. |
|
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 |
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. |