|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Reference to an EntityRegistry's pool of instances of a specific component type. More...
#include <GREM/execution/EntityRegistry.hpp>
Public Types | |
| using | iterator = detail::SingleComponentIterator<Component> |
| using | sentinel = detail::SingleComponentSentinel |
| using | value_type = typename iterator::value_type |
| using | reference = typename iterator::reference |
| using | size_type = size_t |
| using | difference_type = typename iterator::difference_type |
| using | component_type = Component |
Public Member Functions | |
| GREM_ALWAYS_INLINE constexpr | ComponentPool () noexcept=default |
| Construct an invalid component pool reference. | |
| GREM_ALWAYS_INLINE | operator ComponentPool< const Component > () const noexcept |
| Convert a non-const component pool reference to a const component pool reference. | |
| GREM_ALWAYS_INLINE constexpr iterator | begin () const noexcept |
| GREM_ALWAYS_INLINE constexpr sentinel | end () const noexcept |
| GREM_ALWAYS_INLINE constexpr reference | operator[] (EntityID id) const |
| GREM_ALWAYS_INLINE constexpr bool | has (EntityID id) const |
| Check if the referenced pool has a component instance associated with a specific entity. | |
| GREM_ALWAYS_INLINE Component & | get (EntityID id) const |
| Get the component instance associated with a specific entity. | |
| template<typename U> | |
| GREM_ALWAYS_INLINE Component | getOr (EntityID id, U &&defaultValue) const |
| Get the component instance associated with a specific entity, or a default value in case the entity doesn't exist or doesn't have an associated component instance. | |
| GREM_ALWAYS_INLINE Component * | find (EntityID id) const |
| Try to get the component instance associated with a specific entity. | |
| template<typename... Args> requires (!std::is_const_v<Component>) | |
| GREM_ALWAYS_INLINE Component & | add (EntityID id, Args &&... args) |
| Add a component instance associated with a specific entity. | |
| template<typename... Args> requires (!std::is_const_v<Component>) | |
| GREM_ALWAYS_INLINE Component * | addIfMissing (EntityID id, Args &&... args) |
| Add a component instance associated with a specific entity if it doesn't already have one. | |
| GREM_ALWAYS_INLINE Component & | addOrAssign (EntityID id, Component &&value) |
| Add a component instance associated with a specific entity, or assign to it if it already has one. | |
| GREM_ALWAYS_INLINE Component & | addOrAssign (EntityID id, const Component &value) |
| Add a component instance associated with a specific entity, or assign to it if it already has one. | |
| GREM_ALWAYS_INLINE bool | remove (EntityID id) noexcept |
| Erase the component instance associated with a specific entity. | |
| GREM_ALWAYS_INLINE size_type | removeFromAllEntities () noexcept |
| Erase all associated component instances. | |
Friends | |
| template<typename... KnownComponents> | |
| class | EntityRegistry |
| Entity registry used by a Simulation. | |
| template<typename U> | |
| class | ComponentPool |
Reference to an EntityRegistry's pool of instances of a specific component type.
| Component | component type stored in the referenced pool, potentially const-qualified to indicate read-only access. |
| using grem::execution::ComponentPool< Component >::iterator = detail::SingleComponentIterator<Component> |
| using grem::execution::ComponentPool< Component >::sentinel = detail::SingleComponentSentinel |
| using grem::execution::ComponentPool< Component >::value_type = typename iterator::value_type |
| using grem::execution::ComponentPool< Component >::reference = typename iterator::reference |
| using grem::execution::ComponentPool< Component >::size_type = size_t |
| using grem::execution::ComponentPool< Component >::difference_type = typename iterator::difference_type |
| using grem::execution::ComponentPool< Component >::component_type = Component |
|
constexprdefaultnoexcept |
Construct an invalid component pool reference.
|
inlinenoexcept |
Convert a non-const component pool reference to a const component pool reference.
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
Check if the referenced pool has a component instance associated with a specific entity.
| id | entity handle to check. |
|
inline |
Get the component instance associated with a specific entity.
| id | entity handle of the entity to get the component from. |
| std::out_of_range | if the given handle does not correspond to a valid entity that has a component instance stored in the pool. |
|
inline |
Get the component instance associated with a specific entity, or a default value in case the entity doesn't exist or doesn't have an associated component instance.
| id | entity handle of the entity to get the component from. |
| defaultValue | default value to return in case the given handle does not correspond to a valid entity with an associated component instance. |
|
inlinenodiscard |
Try to get the component instance associated with a specific entity.
| id | entity handle of the entity to get the component from. |
|
inline |
Add a component instance associated with a specific entity.
| id | entity handle of the entity to add the component to. |
| args | arguments to forward to the component constructor. |
| std::logic_error | if this component pool reference is invalid, or if the pool already contains a component instance associated with the specified entity. |
| std::out_of_range | if the given handle does not correspond to a valid entity. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the component constructor. |
|
inline |
Add a component instance associated with a specific entity if it doesn't already have one.
| id | entity handle of the entity to add the component to. |
| args | arguments to forward to the component constructor. |
| std::logic_error | if this component pool reference is invalid. |
| std::out_of_range | if the given handle does not correspond to a valid entity. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the component constructor. |
|
inline |
Add a component instance associated with a specific entity, or assign to it if it already has one.
| id | entity handle of the entity to assign the component to. |
| value | component value to add or assign. |
| std::logic_error | if this component pool reference is invalid. |
| std::out_of_range | if the given handle does not correspond to a valid entity. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the move constructor or move assignment operator of the component type. |
|
inline |
Add a component instance associated with a specific entity, or assign to it if it already has one.
| id | entity handle of the entity to assign the component to. |
| value | component value to add or assign. |
| std::logic_error | if this component pool reference is invalid. |
| std::out_of_range | if the given handle does not correspond to a valid entity. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the copy constructor or copy assignment operator of the component type. |
|
inlinenoexcept |
Erase the component instance associated with a specific entity.
| id | entity handle of the entity to remove the component from. |
|
inlinenoexcept |
Erase all associated component instances.
|
friend |
Entity registry used by a Simulation.
| N | number of dimensions of the world space (must be 2 or 3). |
|
friend |