Gaia-ECS v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::cnt::page_storage< T > Class Template Reference

Array with variable size of elements of type. More...

#include <paged_storage.h>

Public Types

using value_type = T
 
using reference = T &
 
using const_reference = const T &
 
using pointer = T *
 
using const_pointer = const T *
 
using view_policy = mem::auto_view_policy< T >
 
using difference_type = detail::difference_type
 
using size_type = detail::size_type
 
using Allocator = mem::PagedAllocator< T, AllocatorBlockSize >
 
using page_data_type = detail::mem_page_data< T >
 
using page_type = detail::mem_page< T, Allocator >
 
using iterator = page_iterator< T, Allocator, true >
 
using iterator_reverse = page_iterator< T, Allocator, false >
 
using iterator_soa = page_iterator_soa< T, Allocator, true >
 
using iterator_soa_reverse = page_iterator_soa< T, Allocator, false >
 
using const_iterator = const_page_iterator< T, Allocator, true >
 
using const_iterator_reverse = const_page_iterator< T, Allocator, false >
 
using const_iterator_soa = const_page_iterator_soa< T, Allocator, true >
 
using const_iterator_soa_reverse = const_page_iterator_soa< T, Allocator, false >
 
using iterator_category = core::bidirectional_iterator_tag
 

Public Member Functions

 page_storage (const page_storage &other)
 
page_storageoperator= (const page_storage &other)
 
 page_storage (page_storage &&other) noexcept
 
page_storageoperator= (page_storage &&other) noexcept
 
GAIA_NODISCARD decltype(auto) operator[] (page_storage_id id) noexcept
 
GAIA_NODISCARD decltype(auto) operator[] (page_storage_id id) const noexcept
 
GAIA_NODISCARD bool has (page_storage_id id) const noexcept
 Checks if an item with a given page id exists.
 
GAIA_NODISCARD bool has (const T &arg) const noexcept
 Checks if an item arg exists within the storage.
 
template<typename TType >
decltype(auto) add (TType &&arg)
 Inserts the item arg into the storage.
 
decltype(auto) set (page_storage_id id)
 Update the record at the index id.
 
void del (page_storage_id id) noexcept
 Removes the item at the index id from the storage.
 
void del (const T &arg) noexcept
 Removes the item arg from the storage.
 
void clear ()
 Clears the storage.
 
GAIA_NODISCARD size_type size () const noexcept
 Returns the number of items inserted into the storage.
 
GAIA_NODISCARD bool empty () const noexcept
 Checks if the storage is empty (no items inserted)
 
GAIA_NODISCARD decltype(auto) front () noexcept
 
GAIA_NODISCARD decltype(auto) front () const noexcept
 
GAIA_NODISCARD decltype(auto) back () noexcept
 
GAIA_NODISCARD decltype(auto) back () const noexcept
 
GAIA_NODISCARD auto begin () noexcept
 
GAIA_NODISCARD auto begin () const noexcept
 
GAIA_NODISCARD auto cbegin () const noexcept
 
GAIA_NODISCARD auto end () noexcept
 
GAIA_NODISCARD auto end () const noexcept
 
GAIA_NODISCARD auto cend () const noexcept
 
GAIA_NODISCARD auto rbegin () noexcept
 
GAIA_NODISCARD auto rbegin () const noexcept
 
GAIA_NODISCARD auto crbegin () const noexcept
 
GAIA_NODISCARD auto rend () noexcept
 
GAIA_NODISCARD auto rend () const noexcept
 
GAIA_NODISCARD auto crend () const noexcept
 
GAIA_NODISCARD bool operator== (const page_storage &other) const noexcept
 
GAIA_NODISCARD bool operator!= (const page_storage &other) const noexcept
 

Static Public Attributes

static constexpr uint32_t AllocatorBlockSize = (uint32_t)sizeof(detail::mem_page_data<T>)
 
static constexpr uint32_t PageCapacity = page_type::PageCapacity
 

Detailed Description

template<typename T>
class gaia::cnt::page_storage< T >

Array with variable size of elements of type.

Template Parameters
Tallocated on heap. Allocates enough memory to support
PageCapacityelements. Uses
Allocatorto allocate memory.

Member Function Documentation

◆ add()

template<typename T >
template<typename TType >
decltype(auto) gaia::cnt::page_storage< T >::add ( TType &&  arg)
inline

Inserts the item arg into the storage.

Parameters
argData
Returns
Reference to the inserted record or nothing in case it is has a SoA layout.

◆ del() [1/2]

template<typename T >
void gaia::cnt::page_storage< T >::del ( const T &  arg)
inlinenoexcept

Removes the item arg from the storage.

Parameters
argData

◆ del() [2/2]

template<typename T >
void gaia::cnt::page_storage< T >::del ( page_storage_id  id)
inlinenoexcept

Removes the item at the index id from the storage.

Parameters
idPage id

◆ has() [1/2]

template<typename T >
GAIA_NODISCARD bool gaia::cnt::page_storage< T >::has ( const T &  arg) const
inlinenoexcept

Checks if an item arg exists within the storage.

Parameters
argData

◆ has() [2/2]

template<typename T >
GAIA_NODISCARD bool gaia::cnt::page_storage< T >::has ( page_storage_id  id) const
inlinenoexcept

Checks if an item with a given page id exists.

Parameters
idPage id

◆ set()

template<typename T >
decltype(auto) gaia::cnt::page_storage< T >::set ( page_storage_id  id)
inline

Update the record at the index id.

Parameters
idPage id
Returns
Reference to the inserted record or nothing in case it is has a SoA layout.

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