![]() |
Gaia-ECS v1.0.0
A simple and powerful entity component system
|
Array with variable size of elements of type T allocated on heap. Allocates enough memory to support PageCapacity elements. Uses Allocator to allocate memory. More...
#include <sparse_storage.h>
Public Types | |
| using | value_type = T |
| Stored value type. | |
| using | reference = T & |
| Mutable value reference. | |
| using | const_reference = const T & |
| Constant value reference. | |
| using | pointer = T * |
| Mutable value pointer. | |
| using | const_pointer = const T * |
| Constant value pointer. | |
| using | view_policy = mem::data_view_policy_aos< T > |
| Data access policy. | |
| using | difference_type = detail::difference_type |
| Type used for iterator distances. | |
| using | size_type = detail::size_type |
| Type used for sizes and offsets. | |
| using | iterator = sparse_iterator< T, PageCapacity, Allocator > |
| Mutable iterator type. | |
| using | const_iterator = const_sparse_iterator< T, PageCapacity, Allocator > |
| Constant iterator type. | |
| using | page_type = detail::sparse_page< T, PageCapacity, Allocator > |
| Internal sparse-page type. | |
Public Member Functions | |
| sparse_storage (const sparse_storage &other) | |
| Copy-constructs the storage. | |
| sparse_storage & | operator= (const sparse_storage &other) |
| Copy-assigns the storage. | |
| sparse_storage (sparse_storage &&other) noexcept | |
| Move-constructs the storage. | |
| sparse_storage & | operator= (sparse_storage &&other) noexcept |
| Move-assigns the storage. | |
| GAIA_NODISCARD decltype(auto) | operator[] (sparse_id sid) noexcept |
| Returns the value associated with a sparse identifier. | |
| GAIA_NODISCARD decltype(auto) | operator[] (sparse_id sid) const noexcept |
| Returns the value associated with a sparse identifier. | |
| GAIA_NODISCARD bool | has (sparse_id sid) const |
| Checks whether an item with a sparse identifier exists. | |
| GAIA_NODISCARD bool | has (const T &arg) const |
| 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 (sparse_id sid) |
| Update the record at the index sid. | |
| void | del (sparse_id sid) noexcept |
| Removes the item at the index sid 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 |
| Returns the first stored value. | |
| GAIA_NODISCARD decltype(auto) | front () const noexcept |
| Returns the first stored value. | |
| GAIA_NODISCARD decltype(auto) | back () noexcept |
| Returns the last stored value. | |
| GAIA_NODISCARD decltype(auto) | back () const noexcept |
| Returns the last stored value. | |
| GAIA_NODISCARD auto | begin () noexcept |
| Returns an iterator to the first value. | |
| GAIA_NODISCARD auto | begin () const noexcept |
| Returns an iterator to the first value. | |
| GAIA_NODISCARD auto | cbegin () const noexcept |
| Returns a constant iterator to the first value. | |
| GAIA_NODISCARD auto | end () noexcept |
| Returns an iterator past the last value. | |
| GAIA_NODISCARD auto | end () const noexcept |
| Returns an iterator past the last value. | |
| GAIA_NODISCARD auto | cend () const noexcept |
| Returns a constant iterator past the last value. | |
| GAIA_NODISCARD bool | operator== (const sparse_storage &other) const |
| Checks whether two storages contain equal values at equal sparse identifiers. | |
| GAIA_NODISCARD constexpr bool | operator!= (const sparse_storage &other) const |
| Checks whether two storages differ. | |
Array with variable size of elements of type T allocated on heap. Allocates enough memory to support PageCapacity elements. Uses Allocator to allocate memory.
| T | Stored value type. param PageCapacity Number of sparse entries represented by each page. Must be a power of two. |
| Allocator | Allocator used by the storage pages. |
|
inline |
Copy-constructs the storage.
| other | Storage to copy. |
|
inlinenoexcept |
Move-constructs the storage.
| other | Storage to move from. |
|
inline |
Inserts the item arg into the storage.
| arg | Data |
| TType | Inserted value type. |
|
inlinenoexcept |
Returns the last stored value.
|
inlinenoexcept |
Returns the last stored value.
|
inlinenoexcept |
Returns an iterator to the first value.
|
inlinenoexcept |
Returns an iterator to the first value.
|
inlinenoexcept |
Returns a constant iterator to the first value.
|
inlinenoexcept |
Returns a constant iterator past the last value.
|
inlinenoexcept |
Removes the item arg from the storage.
| arg | Data |
|
inlinenoexcept |
Removes the item at the index sid from the storage.
| sid | Sparse id |
|
inlinenoexcept |
Checks if the storage is empty (no items inserted).
|
inlinenoexcept |
Returns an iterator past the last value.
|
inlinenoexcept |
Returns an iterator past the last value.
|
inlinenoexcept |
Returns the first stored value.
|
inlinenoexcept |
Returns the first stored value.
|
inline |
Checks if an item arg exists within the storage.
| arg | Data |
|
inline |
Checks whether an item with a sparse identifier exists.
| sid | Sparse identifier to find. |
|
inlineconstexpr |
Checks whether two storages differ.
| other | Storage to compare. |
|
inline |
Copy-assigns the storage.
| other | Storage to copy. |
|
inlinenoexcept |
Move-assigns the storage.
| other | Storage to move from. |
|
inline |
Checks whether two storages contain equal values at equal sparse identifiers.
| other | Storage to compare. |
|
inlinenoexcept |
Returns the value associated with a sparse identifier.
| sid | Sparse identifier to access. It must exist. |
|
inlinenoexcept |
Returns the value associated with a sparse identifier.
| sid | Sparse identifier to access. It must exist. |
|
inline |
Update the record at the index sid.
| sid | Sparse id |
|
inlinenoexcept |
Returns the number of items inserted into the storage.