Template Class component_pool¶
Defined in File component_pool.hpp
Inheritance Relationships¶
Base Type¶
public legion::core::ecs::component_pool_base
(Class component_pool_base)
Class Documentation¶
-
template<typename
component_type
>
classlegion::core::ecs
::
component_pool
: public legion::core::ecs::component_pool_base¶ Thread-safe container to store a component family in.
- Template Parameters
component_type
: Type of component.
Public Functions
-
component_pool
() = default¶
-
inline
component_pool
(EcsRegistry *registry, events::EventBus *eventBus)¶
-
inline async::rw_spinlock &
get_lock
() const noexcept¶ Get the rw_spinlock of this container.
-
inline virtual component_container_base *
get_components
(const entity_container &entities) const override¶
-
inline virtual void
get_components
(const entity_container &entities, component_container_base &comps) const override¶
-
inline virtual void
set_components
(const entity_container &entities, const component_container_base &comps) override¶
-
inline virtual bool
has_component
(id_type entityId) const override¶ Thread-safe check for whether an entity has the component.
- Parameters
entityId
: ID of the entity you wish to check for.
-
inline component_type &
get_component
(id_type entityId)¶ Thread unsafe component fetch, use component_pool::get_lock and lock for at least read_only before calling this function.
- Parameters
entityId
: ID of entity you want to get the component from. component_pool::get_lock() legion::core::async::rw_spinlock
-
inline const component_type &
get_component
(id_type entityId) const¶ Thread unsafe component fetch, use component_pool::get_lock and lock for at least read_only before calling this function.
- Parameters
entityId
: ID of entity you want to get the component from. component_pool::get_lock() legion::core::async::rw_spinlock
-
inline virtual void
create_component
(id_type entityId) override¶ Creates component in a thread-safe way.
- Note
Calls component_type::init if it exists.
- Note
Raises the events::component_creation<component_type>> event.
- Parameters
entityId
: ID of entity you wish to add the component to.
-
inline virtual void
create_component
(id_type entityId, void *value) override¶ Creates component in a thread-safe way and initializes it with the given value.
- Note
Does NOT call component_type::init.
- Note
Raises the events::component_creation<component_type>> event.
- Parameters
entityId
: ID of entity you wish to add the component to.value
: Pointer to component_type that has the starting value you require.