Gaia-ECS v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::cnt::paged_ilist< TListItem, TItemHandle > Struct Template Reference

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. 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_ilistoperator= (const paged_ilist &)=delete
 
 paged_ilist (paged_ilist &&other) noexcept
 
paged_ilistoperator= (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)
 
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 freelist link.
 
void add_free (size_type index, uint32_t generation, uint32_t nextFreeIdx)
 Restores a free slot with a preassigned id/generation and freelist 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)
 
void validate () const
 

Public Attributes

size_type m_nextFreeIdx = (size_type)-1
 
size_type m_freeItems = 0
 

Detailed Description

template<typename TListItem, typename TItemHandle>
struct gaia::cnt::paged_ilist< TListItem, TItemHandle >

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.

Template Parameters
TListItemPayload type stored in the list. Must expose slot metadata through ilist_item_traits<TListItem> and ilist-compatible create()/handle() helpers.
TItemHandleExternal handle type exposing id(), gen(), and IdMask.

The documentation for this struct was generated from the following file: