View of entities in an EntityRegistry that have all of the required components and none of the excluded components specified in a list of types.
More...
#include <GREM/execution/EntityRegistry.hpp>
|
| template<typename... KnownComponents> |
| class | EntityRegistry |
| | Entity registry used by a Simulation.
|
template<typename... ComponentsAndExclusions>
class grem::execution::Entities< ComponentsAndExclusions >
View of entities in an EntityRegistry that have all of the required components and none of the excluded components specified in a list of types.
- Template Parameters
-
| ComponentsAndExclusions | component and component exclusion types (e.g. Exclude<Component>) that specify which entities are part of the range. |
◆ MutableComponents
template<typename... ComponentsAndExclusions>
List of non-const components required by the range, provided as a meta::TypeList.
◆ ImmutableComponents
template<typename... ComponentsAndExclusions>
List of const components required by the range, provided as a meta::TypeList.
◆ IncludedComponents
template<typename... ComponentsAndExclusions>
List of components required by the range, provided as a meta::TypeList.
◆ ExcludedComponents
template<typename... ComponentsAndExclusions>
List of components excluded by the range, provided as a meta::TypeList.
◆ iterator
template<typename... ComponentsAndExclusions>
◆ sentinel
template<typename... ComponentsAndExclusions>
◆ value_type
template<typename... ComponentsAndExclusions>
◆ reference
template<typename... ComponentsAndExclusions>
◆ size_type
template<typename... ComponentsAndExclusions>
◆ difference_type
template<typename... ComponentsAndExclusions>
◆ Entities() [1/2]
template<typename... ComponentsAndExclusions>
Construct an empty entity range.
◆ Entities() [2/2]
template<typename... ComponentsAndExclusions>
Construct an entity subrange from an iterator pair.
- Parameters
-
| first | begin iterator of the subrange. |
| last | past-the-end iterator of the subrange. |
- Warning
- The subrange [first, last) must form a valid range.
◆ begin()
template<typename... ComponentsAndExclusions>
|
|
inlinenodiscardconstexprnoexcept |
◆ end()
template<typename... ComponentsAndExclusions>
|
|
inlinenodiscardconstexprnoexcept |
◆ getCandidateCount()
template<typename... ComponentsAndExclusions>
|
|
inlinenodiscardconstexprnoexcept |
Get an upper bound estimate on the number of entities in the range.
- Returns
- a number greater than or equal to std::distance(begin(), end()).
◆ containsEntity()
template<typename... ComponentsAndExclusions>
Check if the range contains a specific entity.
- Parameters
-
| id | entity handle to check. |
- Returns
- true if the given handle corresponds to a valid entity in this range, false otherwise.
◆ operator[]()
template<typename... ComponentsAndExclusions>
◆ hasComponent()
template<typename... ComponentsAndExclusions>
template<component T>
Check if the range contains a specific entity with a specific component.
- Template Parameters
-
| T | component type to check for. Must be one of the component types required by this entity range. |
- Parameters
-
| id | entity handle to check. |
- Returns
- true if the given handle corresponds to a valid entity in this range that has the specified component, false otherwise.
◆ getComponent()
template<typename... ComponentsAndExclusions>
template<component T>
Get a specific component of a specific entity in the range.
- Template Parameters
-
| T | component type to get. Must be one of the component types required by this entity range. |
- Parameters
-
| id | entity handle of the entity to get the component from. |
- Returns
- a reference to the specified component of the specified entity.
- Exceptions
-
| std::out_of_range | if the given handle does not correspond to a valid entity in this range that has the specified component. |
◆ getComponentOr()
template<typename... ComponentsAndExclusions>
template<component T, typename U>
Get a specific component of a specific entity in the range, or a default value in case the entity doesn't exist or doesn't have the specified component.
- Template Parameters
-
| T | component type to get. Must be one of the component types required by this entity range. |
- Parameters
-
| 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 the specified component. |
- Returns
- a copy of the specified component of the specified entity, or the specified default value if the given handle does not correspond to a valid entity in this range that has the specified component.
◆ findComponent()
template<typename... ComponentsAndExclusions>
template<component T>
Try to get a specific component of a specific entity in the range.
- Template Parameters
-
| T | component type to get. Must be one of the component types required by this entity range. |
- Parameters
-
| id | entity handle of the entity to get the component from. |
- Returns
- a pointer to the specified component of the specified entity, or nullptr if the given handle does not correspond to a valid entity in this range that has the specified component.
◆ getEntityIDAtEntityIndexUnsafe()
template<typename... ComponentsAndExclusions>
Get the entity handle of the entity in a specific slot of the underlying EntityRegistry.
- Parameters
-
| slotIndex | index of the entity slot in the underlying EntityRegistry to get the entity handle of. Must be a valid slot index corresponding to an entity that is currently valid, e.g. the result of a previous call to id.getIndex() on a valid entity handle id that has not since been invalidated. |
- Returns
- the entity handle of the entity in the specified slot.
◆ getComponentAtEntityIndexUnsafe()
template<typename... ComponentsAndExclusions>
template<component T>
Get a specific component of the entity in a specific slot of the underlying EntityRegistry.
- Template Parameters
-
| T | component type to get. Must be one of the component types required by this entity range. |
- Parameters
-
| slotIndex | index of the entity slot in the underlying EntityRegistry to get the entity handle of. Must be a valid slot index corresponding to an entity that is currently valid and has the specified component, e.g. the result of a previous call to id.getIndex() on a valid entity handle id that is known to have the specified component, and has not since been invalidated. |
- Returns
- a reference to the specified component of the entity in the specified slot.
◆ EntityRegistry
template<typename... ComponentsAndExclusions>
template<typename... KnownComponents>
| friend class EntityRegistry |
|
friend |
Entity registry used by a Simulation.
- Template Parameters
-
| N | number of dimensions of the world space (must be 2 or 3). |
The documentation for this class was generated from the following file: